Skip to content

Commit

Permalink
Manual backport of PR ManageIQ#13440 for Euwe release
Browse files Browse the repository at this point in the history
  • Loading branch information
mkanoor committed Jan 17, 2017
1 parent 61a1701 commit 4e85255
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/miq_automation_engine/engine/miq_ae_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def process_args_array(args, args_key)
# process Array::servers => MiqServer::2,MiqServer::3,MiqServer::4
key = args_key.split(CLASS_SEPARATOR).last
value = args.delete(args_key)
args[key] = load_array_objects_from_string(value)
args[key.downcase] = load_array_objects_from_string(value)
end

def process_args_attribute(args, args_key)
Expand Down
10 changes: 10 additions & 0 deletions spec/lib/miq_automation_engine/miq_ae_object_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ def value_match(value, xml_value)
expect(result["vms"].length).to eq(1)
end

it "#process_args_as_attributes with mixed types and case insensitive" do
result = @miq_obj.process_args_as_attributes("Array::VMs" => "VmOrTemplate::#{@vm.id}",
"Name" => "fred")
expect(result["vms"]).to be_kind_of(Array)
expect(result["vms"].length).to eq(1)
expect(result["VMs"]).to be_nil
expect(result["name"]).to eq("fred")
expect(result["Name"]).to be_nil
end

it "#process_args_as_attributes with an array" do
vm2 = FactoryGirl.create(:vm_vmware)
result = @miq_obj.process_args_as_attributes({"Array::vms" => "VmOrTemplate::#{@vm.id},VmOrTemplate::#{vm2.id}"})
Expand Down

0 comments on commit 4e85255

Please sign in to comment.