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

The vm_id coming in from API is a string. #17674

Merged
merged 1 commit into from
Jul 9, 2018
Merged
Show file tree
Hide file tree
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
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 @@ -41,8 +41,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 @@ -83,9 +83,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
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