Skip to content

Commit

Permalink
save_vms_inventory needs to respect disconnect flag
Browse files Browse the repository at this point in the history
When we provision new vm we call `save_ems_inventory_no_disconnect`
which updates the db with disconnect flag set to false.
`save_vms_inventory` ignores the flag and disconnects the vms (ems set to nil).
This patch fixes the issue.
  • Loading branch information
pkliczewski committed Sep 5, 2017
1 parent 5532481 commit 5717376
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/ems_refresh/save_inventory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
[]
Expand Down

0 comments on commit 5717376

Please sign in to comment.