Bug #20098
closedCannot resolve user_data template with all kind of compute-resource
Description
This seems to be a problem with 1.15.0 and 1.15.1. I did a standard install on a new machine with everything local. When I try to create a new host, it is not able to resolve the user_data template. The following message appears in the log:
2017-06-20 11:13:20 2dd4694b [app] [I] Started POST "/hosts/template_used?provisioning=image" for 10.10.0.162 at 2017-
06-20 11:13:20 -0400
2017-06-20 11:13:20 2dd4694b [app] [I] Processing by HostsController#template_used as */*
2017-06-20 11:13:20 2dd4694b [app] [I] Parameters: {"utf8"=>"✓", "authenticity_token"=>"yv2pKrr9/2HXyU5gypJHwgwYYTZp
5YlrJ28gry7wKAR23xX4ZGvGd6u19VrFuwfE8SkrAjO3IFsDc0s6l/V9qg==", "host"=>{"name"=>"kurt-benites", "hostgroup_id"=>"8", "
compute_resource_id"=>"6", "puppetclass_ids"=>[""], "managed"=>"true", "progress_report_id"=>"[FILTERED]", "type"=>"Ho
st::Managed", "interfaces_attributes"=>{"0"=>{"_destroy"=>"0", "type"=>"Nic::Managed", "mac"=>"", "identifier"=>"", "n
ame"=>"kurt-benites", "domain_id"=>"4", "subnet_id"=>"8", "ip"=>"", "ip6"=>"", "managed"=>"1", "primary"=>"1", "provis
ion"=>"1", "virtual"=>"0", "tag"=>"", "attached_to"=>""}, "new_interfaces"=>{"_destroy"=>"1", "type"=>"Nic::Managed",
"mac"=>"", "identifier"=>"", "name"=>"", "domain_id"=>"", "subnet_id"=>"", "ip"=>"", "ip6"=>"", "managed"=>"1", "prima
ry"=>"0", "provision"=>"0", "virtual"=>"0", "tag"=>"", "attached_to"=>""}}, "compute_attributes"=>{"flavor_id"=>"m1.sm
all", "availability_zone"=>"", "subnet_id"=>"", "security_group_ids"=>[""], "managed_ip"=>"public", "image_id"=>"ami-1
3755605"}, "architecture_id"=>"4", "operatingsystem_id"=>"4", "provision_method"=>"image", "build"=>"1", "medium_id"=>
"", "pxe_loader"=>"", "disk"=>"", "root_pass"=>"[FILTERED]", "is_owned_by"=>"22-Users", "enabled"=>"1", "model_id"=>""
, "comment"=>"", "overwrite"=>"false"}, "capabilities"=>"image key_pair", "provider"=>"EC2", "fakepassword"=>"[FILTERE
D]", "bare_metal_capabilities"=>"build", "provisioning"=>"image"}
2017-06-20 11:13:20 2dd4694b [app] [I] Current user: michaels (administrator)
2017-06-20 11:13:20 2dd4694b [app] [W] Action failed
| NoMethodError: undefined method `[]' for nil:NilClass
| /usr/share/foreman/app/models/concerns/hostext/operating_system.rb:42:in `template_kinds'
| /usr/share/foreman/app/models/concerns/hostext/operating_system.rb:25:in `available_template_kinds'
| /usr/share/foreman/app/controllers/hosts_controller.rb:649:in `template_used'
If I follow the exact same steps using version 1.14.x, everything works as expected. I have also upgrade another separate instance from 1.14 to 1.15, and it ends up with the same issue.