Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Set EMS status when during orchestrate_destroy #16574

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions app/models/ext_management_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -431,14 +431,22 @@ def self.ems_physical_infra_discovery_types
@ems_physical_infra_discovery_types ||= %w(lenovo_ph_infra)
end

def deleting?
status == "deleting"
end

def disable!
_log.info("Disabling EMS [#{name}] id [#{id}].")
update!(:enabled => false)
end

def enable!
_log.info("Enabling EMS [#{name}] id [#{id}].")
update!(:enabled => true)
if deleting?
_log.info("Not re-enabling EMS [#{name}] id [#{id}] because it is being deleted.")
else
_log.info("Enabling EMS [#{name}] id [#{id}].")
update!(:enabled => true)
end
end

# override destroy_queue from AsyncDeleteMixin
Expand All @@ -461,7 +469,7 @@ def destroy_queue
end

def destroy(task_id = nil)
disable! if enabled?
update!(:enabled => false, :status => "deleting") if enabled?

_log.info("Destroying #{child_managers.count} child_managers")
child_managers.destroy_all
Expand Down