Problem: Unable to resolve provisioning template when creating a new host via image-based provisioning method with a configured host group.
In exactly the same configuration without using the hostgroup itself, the template is resolved.
In the properties of the template, there is an association with the host group.
Expected outcome:
Provisioning template resolved as same as it resolved without hostgroup
Foreman and Proxy versions:
foreman-2.1.1-1 and lower
Foreman and Proxy plugin versions:
katello-3.16.0-1 and lower
Distribution and version:
any rpm-based 6/7/8
**Other relevant data:**
2020-08-14T17:06:06 [I|app|0e3947d1] Parameters: {"utf8"=>"✓", "authenticity_token"=>"**edited**", "host"=>{"name"=>"foremantst02", "organization_id"=>"5", "location_id"=>"1", "hostgroup_id"=>"19", "content_facet_attributes"=>{"lifecycle_environment_id"=>"3", "content_view_id"=>"3", "content_source_id"=>"1"}, "ansible_role_ids"=>[""], "managed"=>"true", "progress_report_id"=>"[FILTERED]", "type"=>"Host::Managed", "interfaces_attributes"=>{"0"=>{"_destroy"=>"0", "type"=>"Nic::Managed", "identifier"=>"", "name"=>"foremantst02", "domain_id"=>"1", "ip"=>"", "ip6"=>"", "managed"=>"1", "primary"=>"1", "provision"=>"1", "execution"=>"1", "virtual"=>"0", "tag"=>"", "attached_to"=>"", "compute_attributes"=>{"type"=>"VirtualVmxnet3", "network"=>"network-55"}}, "new_interfaces"=>{"_destroy"=>"1", "type"=>"Nic::Managed", "mac"=>"", "identifier"=>"", "name"=>"", "domain_id"=>"", "ip"=>"", "ip6"=>"", "managed"=>"1", "primary"=>"0", "provision"=>"0", "execution"=>"0", "virtual"=>"0", "tag"=>"", "attached_to"=>"", "compute_attributes"=>{"type"=>"VirtualE1000", "network"=>"network-194"}}}, "compute_attributes"=>{"cpus"=>"1", "corespersocket"=>"1", "memory_mb"=>"2048", "firmware"=>"bios", "cluster"=>"dc1-vc03-cl05", "resource_pool"=>"Resources", "path"=>"/Datacenters/vdc1-vc03/vm/ALL_VMS", "guest_id"=>"rhel7_64Guest", "hardware_version"=>"Default", "memoryHotAddEnabled"=>"0", "cpuHotAddEnabled"=>"0", "add_cdrom"=>"0", "boot_order"=>["network", "disk"], "start"=>"1", "annotation"=>"", "scsi_controllers"=>"{\"scsiControllers\":[{\"type\":\"VirtualLsiLogicController\",\"key\":1000}],\"volumes\":[{\"thin\":true,\"name\":\"Hard disk\",\"mode\":\"persistent\",\"controllerKey\":1000,\"sizeGb\":50,\"datastore\":\"dc1-hus02-R5-01\",\"storagePod\":null},{\"thin\":true,\"name\":\"Hard disk\",\"mode\":\"independent_persistent\",\"controllerKey\":1000,\"sizeGb\":16,\"datastore\":\"dc1-hus02-R5-01\",\"storagePod\":null,\"eagerZero\":false}]}", "image_id"=>"50049fc1-8210-b10e-aa82-d80281cbf259"}, "architecture_id"=>"1", "operatingsystem_id"=>"29", "provision_method"=>"image", "build"=>"1", "medium_id"=>"", "ptable_id"=>"", "pxe_loader"=>"None", "disk"=>"", "root_pass"=>"[FILTERED]", "is_owned_by"=>"1-Usergroups", "enabled"=>"1", "comment"=>"", "overwrite"=>"false"}, "fakepassword"=>"[FILTERED]", "provisioning"=>"image"}
2020-08-14T17:06:06 [I|app|0e3947d1] Rendering common/404.html.erb within layouts/application
2020-08-14T17:06:06 [I|app|0e3947d1] Rendered common/404.html.erb within layouts/application (Duration: 1.5ms | Allocations: 486)
2020-08-14T17:06:06 [I|app|0e3947d1] Rendered layouts/_application_content.html.erb (Duration: 3.4ms | Allocations: 6186)
2020-08-14T17:06:06 [I|app|0e3947d1] Rendering layouts/base.html.erb
2020-08-14T17:06:06 [I|app|0e3947d1] Rendered layouts/base.html.erb (Duration: 21.4ms | Allocations: 26461)
2020-08-14T17:06:06 [I|app|0e3947d1] Completed 404 Not Found in 62ms (Views: 32.9ms | ActiveRecord: 4.9ms | Allocations: 54903
Same without hostgroup:
2020-08-14T17:13:01 [I|app|b301418e] Parameters: {"utf8"=>"✓", "authenticity_token"=>"WjRprXjPm3L7ZrI5RxACteB+ABOyezAiQdTGXmGRxr+gvDlMQCAisgSkhp/WxSTSbm6cEfHc3Rc3nuY3Ccj81A==", "host"=>{"name"=>"foremantst02", "organization_id"=>"5", "location_id"=>"1", "hostgroup_id"=>"", "compute_resource_id"=>"1", "compute_profile_id"=>"4", "content_facet_attributes"=>{"lifecycle_environment_id"=>"3", "content_view_id"=>"3", "content_source_id"=>"1"}, "environment_id"=>"", "puppet_proxy_id"=>"", "puppet_ca_proxy_id"=>"", "ansible_role_ids"=>[""], "managed"=>"true", "progress_report_id"=>"[FILTERED]", "type"=>"Host::Managed", "interfaces_attributes"=>{"0"=>{"_destroy"=>"0", "type"=>"Nic::Managed", "identifier"=>"", "name"=>"foremantst02", "domain_id"=>"1", "ip"=>"", "ip6"=>"", "managed"=>"1", "primary"=>"1", "provision"=>"1", "execution"=>"1", "virtual"=>"0", "tag"=>"", "attached_to"=>"", "compute_attributes"=>{"type"=>"VirtualVmxnet3", "network"=>"network-55"}}, "new_interfaces"=>{"_destroy"=>"1", "type"=>"Nic::Managed", "mac"=>"", "identifier"=>"", "name"=>"", "domain_id"=>"", "ip"=>"", "ip6"=>"", "managed"=>"1", "primary"=>"0", "provision"=>"0", "execution"=>"0", "virtual"=>"0", "tag"=>"", "attached_to"=>"", "compute_attributes"=>{"type"=>"VirtualE1000", "network"=>"network-194"}}}, "compute_attributes"=>{"cpus"=>"1", "corespersocket"=>"1", "memory_mb"=>"2048", "firmware"=>"bios", "cluster"=>"dc1-vc03-cl05", "resource_pool"=>"Resources", "path"=>"/Datacenters/vdc1-vc03/vm/ALL_VMS", "guest_id"=>"rhel7_64Guest", "hardware_version"=>"Default", "memoryHotAddEnabled"=>"0", "cpuHotAddEnabled"=>"0", "add_cdrom"=>"0", "boot_order"=>["network", "disk"], "start"=>"1", "annotation"=>"", "scsi_controllers"=>"{\"scsiControllers\":[{\"type\":\"VirtualLsiLogicController\",\"key\":1000}],\"volumes\":[{\"thin\":true,\"name\":\"Hard disk\",\"mode\":\"persistent\",\"controllerKey\":1000,\"sizeGb\":50,\"datastore\":\"dc1-hus02-R5-01\",\"storagePod\":null},{\"thin\":true,\"name\":\"Hard disk\",\"mode\":\"independent_persistent\",\"controllerKey\":1000,\"sizeGb\":16,\"datastore\":\"dc1-hus02-R5-01\",\"storagePod\":null,\"eagerZero\":false}]}", "image_id"=>"50049fc1-8210-b10e-aa82-d80281cbf259"}, "architecture_id"=>"1", "operatingsystem_id"=>"29", "provision_method"=>"image", "build"=>"1", "medium_id"=>"", "ptable_id"=>"", "pxe_loader"=>"None", "disk"=>"", "root_pass"=>"[FILTERED]", "is_owned_by"=>"1-Usergroups", "enabled"=>"1", "comment"=>"", "overwrite"=>"false"}, "fakepassword"=>"[FILTERED]", "provisioning"=>"image"}
2020-08-14T17:13:01 [I|app|b301418e] Rendered hosts/_provisioning.html.erb (Duration: 3.0ms | Allocations: 932)
2020-08-14T17:13:01 [I|app|b301418e] Completed 200 OK in 37ms (Views: 4.0ms | ActiveRecord: 6.4ms | Allocations: 16596)