diff --git a/app/models/ems_refresh/save_inventory.rb b/app/models/ems_refresh/save_inventory.rb index e147ccc1ed2..f3b0edb1aa7 100644 --- a/app/models/ems_refresh/save_inventory.rb +++ b/app/models/ems_refresh/save_inventory.rb @@ -36,9 +36,9 @@ def save_vms_inventory(ems, hashes, target = nil, disconnect = true) target = ems if target.nil? && disconnect log_header = "EMS: [#{ems.name}], id: [#{ems.id}]" - disconnects = if target.kind_of?(ExtManagementSystem) || target.kind_of?(Host) + disconnects = if disconnect && (target.kind_of?(ExtManagementSystem) || target.kind_of?(Host)) target.vms_and_templates.reload.to_a - elsif target.kind_of?(Vm) + elsif disconnect && target.kind_of?(Vm) [target.ruby_clone] else []