From 1b32f43f4b464772d4abfb4b089f4c36466bc41b Mon Sep 17 00:00:00 2001 From: Adam Grare Date: Tue, 30 Jul 2019 09:20:52 -0400 Subject: [PATCH] Merge pull request #19077 from yaacov/do-not-get-stuck-on-destroy Do not get stuck on destroy (cherry picked from commit 23750927bd53c88c249dd0c7f0abc0bc2155afaf) Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1763857 --- app/models/ext_management_system.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/models/ext_management_system.rb b/app/models/ext_management_system.rb index 50da7be130f..717511d8085 100644 --- a/app/models/ext_management_system.rb +++ b/app/models/ext_management_system.rb @@ -458,9 +458,10 @@ def self.ems_physical_infra_discovery_types @ems_physical_infra_discovery_types ||= %w(lenovo_ph_infra) end - def disable! + def disable!(validate: true) _log.info("Disabling EMS [#{name}] id [#{id}].") - update!(:enabled => false) + self.enabled = false + save(:validate => validate) end def enable! @@ -488,7 +489,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