Adding host parameter cause template resolve Failure: "Sorry but no templates were configured."

Hi,
Using Foreman 1.7.2
Adding parameter to host causing template resolve Failure on Sorry but no
templates were configured.
Seams like removing the parameter solves the problem.
It is persistent every time i add and remove param from host.

Watching /dev/log/foreman/production.log when clicking on "Resolve" display
the following error:

Started POST "/hosts/template_used?provisioning=build" for 10.100.40.1 at
2015-04-08 17:18:49 -0500
Processing by HostsController#template_used as /
Parameters: {"utf8"=>"✓",
"authenticity_token"=>"+5GV9p1GJPAJ5KcpVTXnB4TozHXl3d8aXXtH3cOFeCU=",
"host"=>{"name"=>"ci12", "hostgroup_id"=>"22", "environment_id"=>"6",
"puppet_ca_proxy_id"=>"1", "puppet_proxy_id"=>"1", "puppetclass_ids"=>[""],
"managed"=>"t", "progress_report_id"=>"[FILTERED]",
"compute_attributes"=>{"volumes_attributes"=>{"new_volumes"=>{"thin"=>"false",
"eager_zero"=>"false"}, "0"=>{"thin"=>"false", "eager_zero"=>"false"}}},
"domain_id"=>"3", "realm_id"=>"", "mac"=>"00:50:56:9e:30:63",
"subnet_id"=>"6", "ip"=>"172.29.52.87",
"interfaces_attributes"=>{"new_interfaces"=>{"_destroy"=>"false",
"type"=>"Nic::Managed", "mac"=>"", "identifier"=>"", "name"=>"",
"domain_id"=>"", "subnet_id"=>"", "ip"=>"", "managed"=>"1", "virtual"=>"0",
"tag"=>"", "attached_to"=>""}}, "architecture_id"=>"1",
"operatingsystem_id"=>"57", "medium_id"=>"20", "ptable_id"=>"7",
"disk"=>"", "root_pass"=>"[FILTERED]",
"host_parameters_attributes"=>{"0"=>{"name"=>"cluster_active",
"value"=>"[FILTERED]", "hidden_value"=>"[FILTERED]", "_destroy"=>"false",
"nested"=>"", "id"=>"190"}}, "is_owned_by"=>"1-Users", "enabled"=>"1",
"comment"=>"", "overwrite"=>"false"}, "capabilities"=>"build image",
"provider"=>"Vmware", "fakepassword"=>"[FILTERED]", "provisioning"=>"build"}
Rendered common/404.html.erb within layouts/application (1.9ms)
Rendered layouts/base.html.erb (1.5ms)
Completed 404 Not Found in 27ms (Views: 5.6ms | ActiveRecord: 3.6ms)

Any idea ?

Looks like "host_parameters_attributes" cause template_used to render
404.html
As a workaround, i have edited "template_used" under hosts_controller.rb
just to ignore "host_parameters_attributes"

def template_used

  • host = Host.new(params[:host].except(:interfaces_attributes,
    :host_parameters_attributes))*
  • templates = host.available_template_kinds(params[:provisioning])*
  • return not_found if templates.empty?*
  • render :partial => 'provisioning', :locals => { :templates =>
    templates }*
  • end*

Meanwhile it solved the problem but please let me know if you are familiar
with the issue and it has a simpler solution.
It is blocker for my needs since i am working tight with foreman_reserve
<https://github.com/david-caro/foreman_reserve> plugin.

Any help?

>
> Hi,
> Using Foreman 1.7.2
>
Adding parameter to host causing template resolve Failure on Sorry but no

··· On Thursday, April 9, 2015 at 1:26:34 AM UTC+3, Avi Tal wrote: > templates were configured. > Seams like removing the parameter solves the problem. > It is persistent every time i add and remove param from host. > > Watching /dev/log/foreman/production.log when clicking on "Resolve" > display the following error: > > Started POST "/hosts/template_used?provisioning=build" for 10.100.40.1 at > 2015-04-08 17:18:49 -0500 > Processing by HostsController#template_used as */* > Parameters: {"utf8"=>"✓", > "authenticity_token"=>"+5GV9p1GJPAJ5KcpVTXnB4TozHXl3d8aXXtH3cOFeCU=", > "host"=>{"name"=>"ci12", "hostgroup_id"=>"22", "environment_id"=>"6", > "puppet_ca_proxy_id"=>"1", "puppet_proxy_id"=>"1", "puppetclass_ids"=>[""], > "managed"=>"t", "progress_report_id"=>"[FILTERED]", > "compute_attributes"=>{"volumes_attributes"=>{"new_volumes"=>{"thin"=>"false", > "eager_zero"=>"false"}, "0"=>{"thin"=>"false", "eager_zero"=>"false"}}}, > "domain_id"=>"3", "realm_id"=>"", "mac"=>"00:50:56:9e:30:63", > "subnet_id"=>"6", "ip"=>"172.29.52.87", > "interfaces_attributes"=>{"new_interfaces"=>{"_destroy"=>"false", > "type"=>"Nic::Managed", "mac"=>"", "identifier"=>"", "name"=>"", > "domain_id"=>"", "subnet_id"=>"", "ip"=>"", "managed"=>"1", "virtual"=>"0", > "tag"=>"", "attached_to"=>""}}, "architecture_id"=>"1", > "operatingsystem_id"=>"57", "medium_id"=>"20", "ptable_id"=>"7", > "disk"=>"", "root_pass"=>"[FILTERED]", > "host_parameters_attributes"=>{"0"=>{"name"=>"cluster_active", > "value"=>"[FILTERED]", "hidden_value"=>"[FILTERED]", "_destroy"=>"false", > "nested"=>"", "id"=>"190"}}, "is_owned_by"=>"1-Users", "enabled"=>"1", > "comment"=>"", "overwrite"=>"false"}, "capabilities"=>"build image", > "provider"=>"Vmware", "fakepassword"=>"[FILTERED]", "provisioning"=>"build"} > Rendered common/404.html.erb within layouts/application (1.9ms) > Rendered layouts/base.html.erb (1.5ms) > Completed 404 Not Found in 27ms (Views: 5.6ms | ActiveRecord: 3.6ms) > > > Any idea ? >