Creation of compute_profile with compute_attributes set failed


We try to create compute_profiles with the given ansible module. If we simply provide name parameter all work well. But if we add data to compute_attributes parameter we get the following output from ansible:

fatal: [localhost]: FAILED! => {"changed": false, "error": {"message": "odd number of arguments for Hash"}, "msg": "Error while performing create on compute_attributes: 500 Server Error: Internal Server Error for url:"}

The corresponding message in server logs are:

2020-09-14T12:35:54 [I|app|db44c3e7] Started POST "/api/compute_profiles/17/compute_resources/7/compute_attributes" for at 2020-09-14 12:35:54 +0000
2020-09-14T12:35:54 [I|app|db44c3e7] Processing by Api::V2::ComputeAttributesController#create as JSON
2020-09-14T12:35:54 [I|app|db44c3e7]   Parameters: {"compute_attribute"=>{"vm_attrs"=>{"cores"=>1, "sockets"=>1, "memory_mb"=>"2048", "firmware"=>"automatic", "cluster"=>"ASH", "resource_pool"=>"Resources", "path"=>"/Datacenters/ASH_i4/vm/ASH_VM", "guest_id"=>"otherGuest64", "hardware_version"=>"Default", "memoryHotAddEnabled"=>"0", "cpuHotAddEnabled"=>"0", "add_cdrom"=>"0", "boot_order"=>["network", "disk"], "annotation"=>"", "scsi_controllers"=>[{"type"=>"VirtualLsiLogicController", "key"=>1000}], "interfaces_attributes"=>[{"type"=>"VirtualE1000", "network"=>"dvportgroup-106"}], "volumes_attributes"=>[{"name"=>"Hard disk", "thin"=>true, "mode"=>"persistent", "controller_key"=>1000, "size_gb"=>10, "datastore"=>"DS_ASH01"}]}}, "apiv"=>"v2", "compute_profile_id"=>"17", "compute_resource_id"=>"7"}
2020-09-14T12:35:54 [W|app|db44c3e7] Action failed

Expected outcome:

The resource should be created or the error message should lead us to a configuration failure.

Foreman and Proxy versions:

Foreman server version: 2.1.2
Foreman ansible modules version: 1.2.0

Other relevant data:

Currently we test with vmware compute ressource.

We created a bug report.
Today we found out that the configuration of some data structures were wrong.

Waiting for response on the bug report and see where it goes.

1 Like

Thanks for reporting and debuging, the input format necessary for the API / modules to work is indeed strange.

I’ll take a look what we can do about that :slight_smile:


It’s not yet tested properly, but I’ve got first draft of enabling compute parameters arrays:

If you could try this, it would be great. It should get tested as much as possible.