Skip to content

Commit

Permalink
Merge pull request #13440 from mkanoor/bugzilla_1408482
Browse files Browse the repository at this point in the history
Inconsistent attribute names inside Automate Engine
  • Loading branch information
gmcculloug authored Jan 12, 2017
2 parents 1971a08 + 18c82f1 commit df1e645
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,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 df1e645

Please sign in to comment.