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

Do not get stuck on destroy #19077

Merged
merged 1 commit into from
Jul 30, 2019
Merged
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
7 changes: 4 additions & 3 deletions app/models/ext_management_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ def destroy_queue
end

def destroy(task_id = nil)
disable! if enabled?
disable!(:validate => false) if enabled?

_log.info("Destroying #{child_managers.count} child_managers")
child_managers.destroy_all
Expand Down Expand Up @@ -838,9 +838,10 @@ def validate_ems_type
errors.add(:base, "emstype #{self.class.name} is not supported for create") unless ExtManagementSystem.supported_types_and_descriptions_hash.key?(emstype)
end

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

Expand Down