Skip to content

Commit

Permalink
Merge pull request #17674 from lfu/v2v_pre_post_ansibile_service
Browse files Browse the repository at this point in the history
The vm_id coming in from API is a string.
  • Loading branch information
gmcculloug authored Jul 9, 2018
2 parents 6586413 + bb86d41 commit 1bb13c5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions app/models/service_template_transformation_plan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def self.default_reconfiguration_entry_point
# :pre_service_id
# :post_service_id
# :actions => [
# {:vm_id => 1, :pre_service => true, :post_service => false},
# {:vm_id => 2, :pre_service => true, :post_service => true},
# {:vm_id => "1", :pre_service => true, :post_service => false},
# {:vm_id => "2", :pre_service => true, :post_service => true},
# ]
#
def self.create_catalog_item(options, _auth_user = nil)
Expand Down Expand Up @@ -85,9 +85,9 @@ def self.validate_config_info(options)

vms = []
if config_info[:actions]
vm_objects = VmOrTemplate.where(:id => config_info[:actions].collect { |vm_hash| vm_hash[:vm_id] }.compact).group_by(&:id)
vm_objects = VmOrTemplate.where(:id => config_info[:actions].collect { |vm_hash| vm_hash[:vm_id] }.compact).index_by(&:id).stringify_keys
config_info[:actions].each do |vm_hash|
vm_obj = vm_objects[vm_hash[:vm_id]].try(:first) || vm_hash[:vm]
vm_obj = vm_objects[vm_hash[:vm_id]] || vm_hash[:vm]
next if vm_obj.nil?

vm_options = {}
Expand Down
4 changes: 2 additions & 2 deletions spec/models/service_template_transformation_plan_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
:pre_service_id => apst.id,
:post_service_id => apst.id,
:actions => [
{:vm_id => vm1.id, :pre_service => true, :post_service => false},
{:vm_id => vm2.id, :pre_service => true, :post_service => true}
{:vm_id => vm1.id.to_s, :pre_service => true, :post_service => false},
{:vm_id => vm2.id.to_s, :pre_service => true, :post_service => true}
],
}
}
Expand Down
4 changes: 2 additions & 2 deletions spec/models/service_template_transformation_plan_task_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
:pre_service_id => apst.id,
:post_service_id => apst.id,
:actions => [
{:vm_id => vm.id, :pre_service => true, :post_service => true},
{:vm_id => vm2.id, :pre_service => false, :post_service => false},
{:vm_id => vm.id.to_s, :pre_service => true, :post_service => true},
{:vm_id => vm2.id.to_s, :pre_service => false, :post_service => false},
],
}
}
Expand Down

0 comments on commit 1bb13c5

Please sign in to comment.