Bug #14282
openForeman GCE can't create new host on custom sub network
Description
I am unable to create gce compute instance on a custom network. I can create it though on default network with a private IP. I am getting following error:
Without external IP enabled
'resource.networkInterfaces[0]': ''. Subnetwork should be specified for custom subnetmode network
relevant part of /var/log/foreman/production.log:
"name"=>"bareos01", "hostgroup_id"=>"2", "compute_resource_id"=>"2", "salt_environment_id"=>"1", "salt_proxy_id"=>"1", "puppetclass_ids"=>[""], "managed"=>"true", "progress_report_id"=>"[FILTERED]", "type"=>"Host::Managed", "interfaces_attributes"=>{"0"=>{"_destroy"=>"0", "type"=>"Nic::Managed", "mac"=>"", "identifier"=>"", "name"=>"bareos01", "domain_id"=>"1", "subnet_id"=>"", "ip"=>"", "managed"=>"1", "primary"=>"1", "provision"=>"1", "execution"=>"1", "virtual"=>"0", "tag"=>"", "attached_to"=>""}, "new_interfaces"=>{"_destroy"=>"1", "type"=>"Nic::Managed", "mac"=>"", "identifier"=>"", "name"=>"", "domain_id"=>"", "subnet_id"=>"", "ip"=>"", "managed"=>"1", "primary"=>"0", "provision"=>"0", "execution"=>"0", "virtual"=>"0", "tag"=>"", "attached_to"=>""}}, "compute_attributes"=>{"machine_type"=>"f1-micro", "network"=>"hslegal-backup-network-1", "external_ip"=>"0", "volumes_attributes"=>{"new_volumes"=>{"_delete"=>"", "size_gb"=>"10"}, "0"=>{"_delete"=>"", "size_gb"=>"10", "id"=>""}}, "image_id"=>"4305665164175986097"}, "architecture_id"=>"3", "operatingsystem_id"=>"2", "provision_method"=>"image", "build"=>"1", "disk"=>"", "root_pass"=>"[FILTERED]", "is_owned_by"=>"3-Users", "enabled"=>"1", "comment"=>"Bareos backup server on Debian jessie. Used for backing up all HS Legal client computers.", "overwrite"=>"false"}, "capabilities"=>"image", "provider"=>"GCE", "fakepassword"=>"[FILTERED]", "bare_metal_capabilities"=>"build", "host_id"=>"null"}
And with external IP enabled:(the subnet error takes place of natIP error)
Invalid value for field 'resource.networkInterfaces[0].accessConfigs[0].natIP': 'true'. Must be an IP address
relevant part of /var/log/foreman/production.log:
"name"=>"bareos01", "hostgroup_id"=>"2", "compute_resource_id"=>"2", "salt_environment_id"=>"1", "salt_proxy_id"=>"1", "puppetclass_ids"=>[""], "managed"=>"true", "progress_report_id"=>"[FILTERED]", "type"=>"Host::Managed", "interfaces_attributes"=>{"0"=>{"_destroy"=>"0", "type"=>"Nic::Managed", "mac"=>"", "identifier"=>"", "name"=>"bareos01", "domain_id"=>"1", "subnet_id"=>"", "ip"=>"", "managed"=>"1", "primary"=>"1", "provision"=>"1", "execution"=>"1", "virtual"=>"0", "tag"=>"", "attached_to"=>""}, "new_interfaces"=>{"_destroy"=>"1", "type"=>"Nic::Managed", "mac"=>"", "identifier"=>"", "name"=>"", "domain_id"=>"", "subnet_id"=>"", "ip"=>"", "managed"=>"1", "primary"=>"0", "provision"=>"0", "execution"=>"0", "virtual"=>"0", "tag"=>"", "attached_to"=>""}}, "compute_attributes"=>{"machine_type"=>"f1-micro", "network"=>"hslegal-backup-network-1", "external_ip"=>"1", "volumes_attributes"=>{"new_volumes"=>{"_delete"=>"", "size_gb"=>"10"}, "0"=>{"_delete"=>"", "size_gb"=>"10", "id"=>""}}, "image_id"=>"4305665164175986097"}, "architecture_id"=>"3", "operatingsystem_id"=>"2", "provision_method"=>"image", "build"=>"1", "disk"=>"", "root_pass"=>"[FILTERED]", "is_owned_by"=>"3-Users", "enabled"=>"1", "comment"=>"Bareos backup server on Debian jessie. Used for backing up all HS Legal client computers.", "overwrite"=>"false"}, "capabilities"=>"image", "provider"=>"GCE", "fakepassword"=>"[FILTERED]", "bare_metal_capabilities"=>"build", "host_id"=>"null"}