Set the VMWare resource pool via the REST API for new Hosts

Problem:
I’m trying to create multiple VMWare hosts via the API from the same compute profile, that are in the same datacenter, but different clusters and resource pools.

My API Call looks like this:

    {
      "host": {
        "architecture_name": "x86_64",
        "build": 1,
        "compute_attributes": {
          "cluster": "domain-c390091",
          "resource_pool": "resgroup-397706"
        },
        "compute_profile_id": 1,
        "compute_resource_id": 17,
        "enabled": 1,
        "environment_id": "9", 
        "host_parameters_attributes": {},
        "hostgroup_id": "154",
        "interfaces_attributes": [
          {
            "compute_attributes": {
              "name": "eth0",
              "network": "VLAN45"
            },
            "domain_id": "2",
            "identifier": "eth0",
            "ip": "10.NNN.NNN.NNN",
            "managed": 1, 
            "primary": 1,
            "provision": 1,
            "subnet_id": "3"
          } 
        ],  
        "managed": 1,
        "medium_id": 9,
        "name": "foreman-test1.something.com",
        "operatingsystem_id": 33,
        "owner_id": 1,
        "owner_type": "Usergroup",
        "ptable_id": 130,
        "puppet_ca_proxy_id": 2,
        "puppet_proxy_id": 2,
        "pxe_loader": "PXELinux BIOS",
        "volumes_attributes": [
          {
            "datastore": "datastore name"
          }
        ]   
      }   
    }

I’m getting:

    422 Unprocessable Entity
    Failed to create a compute VMware VDC (VMware) instance ansible-role-foreman-test1.ewu.tb.noris.de: undefined method `resourcePool' for nil:NilClass

Expected outcome:

    201 OK

Foreman and Proxy versions:

    "foreman_version": "1.19.0"

Foreman and Proxy plugin versions:
Can’t find a VMWare Plugin

When I set a cluster and and a resource pool in the compute profile it works. If I don’t it doesn’t. So is this supported at all, what I’m doing? How would I implement my use case?

Thank you
Marc

Hi Marc,

I will start looking into this and get back to you.

@Marc_Popp1

Can you share the production.log so I can see the full fog-vsphere traceback please?

Have you fixed this issue or this issue still persist in Foreman further releases?