Project

General

Profile

Actions

Bug #8472

open

Clicking resolve generates ERF42-8380 (Must provide an operating systems)

Added by Christopher Voltz over 9 years ago. Updated over 9 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Host creation
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Steps to reproduce

  1. Install Foreman 1.6.3
  2. Configure OS and templates so CentOS 7.0 will return the following:
    $ hammer os info --id 3
    Id:                 3
    Full name:          CentOS 7.0
    Release name:       maipo
    Family:             Redhat
    Name:               CentOS
    Major version:      7
    Minor version:      0
    Partition tables:
        Kickstart default
        Kickstart non-LVM
        Default templates:
        Kickstart default finish (finish)
        Kickstart default iPXE (iPXE)
        Kickstart default PXELinux (PXELinux)
        Kickstart default user data (user_data)
        Kickstart RHEL default (provision)
    Architectures:
        x86_64
    Installation media:
        CentOS mirror
    Templates:
        Kickstart default (provision)
        Kickstart default finish (finish)
        Kickstart default iPXE (iPXE)
        Kickstart default PXELinux (PXELinux)
        Kickstart default user data (user_data)
        Kickstart RHEL default (provision)
    Parameters:
    
  3. Login to foreman using the admin account
  4. Click Hosts | New Host
  5. Click the Operating Systems tab
  6. Select x86_64 for the Architecture
  7. Select CentOS 7.0 for the Operating System
  8. Build mode should be checked (by default)
  9. Select CentOS mirror for the Media
  10. Select Kickstart Default for the Partition table
  11. Click the Resolve button

The Web UI will report

Sorry but no templates were configured.

The production.log will show:

Started POST "/hosts/template_used?provisioning=build" for 16.100.200.51 at 2014-11-20 14:29:53 -0600
Processing by HostsController#template_used as */*
Parameters: {"utf8"=>"✓", "authenticity_token"=>"de9nXEA1XHe1QOU/5SvcEonWWZ3VIGeHP3mwqIC4qs0=", "host"=>{"name"=>"", "location_id"=>"1", "hostgroup_id"=>"",
"compute_resource_id"=>"", "environment_id"=>"", "puppet_ca_proxy_id"=>"", "puppet_proxy_id"=>"", "salt_proxy_id"=>"", "salt_environment_id"=>"",
"salt_module_ids"=>[""], "managed"=>"true", "progress_report_id"=>"[FILTERED]", "type"=>"Host::Managed", "domain_id"=>"", "realm_id"=>"", "mac"=>"", "ip"=>"",
"interfaces_attributes"=>{"new_interfaces"=>{"_destroy"=>"false", "type"=>"Nic::Managed", "mac"=>"", "name"=>"", "domain_id"=>"", "ip"=>"", "provider"=>"IPMI"}},
"architecture_id"=>"1", "provision_method"=>"build", "build"=>"1", "disk"=>"", "root_pass"=>"[FILTERED]", "is_owned_by"=>"3-Users", "enabled"=>"1", "model_id"=>"",
"comment"=>"", "overwrite"=>"false"}, "hostgroup"=>{"operatingsystem_id"=>"3", "medium_id"=>"1", "ptable_id"=>"7"}, "provisioning"=>"build"}
User Load (0.4ms)  SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1  [["id", 3]]
Setting current user thread-local variable to admin
(0.5ms)  SELECT COUNT(*) FROM "taxonomies" WHERE "taxonomies"."type" IN ('Location')
Location Load (0.5ms)  SELECT "taxonomies".* FROM "taxonomies" WHERE "taxonomies"."type" IN ('Location') AND "taxonomies"."id" = 1 ORDER BY title LIMIT 1
Setting current location thread-local variable to lab
AuthSource Load (0.8ms)  SELECT "auth_sources".* FROM "auth_sources" WHERE "auth_sources"."id" = 1 LIMIT 1
(0.3ms)  SELECT id FROM "taxonomies" WHERE "taxonomies"."type" IN ('Location') LIMIT 1
TemplateKind Load (0.3ms)  SELECT "template_kinds".* FROM "template_kinds" 
Operation FAILED: ERF42-8380 [Foreman::Exception]: Must provide an operating systems
/usr/share/foreman/app/models/config_template.rb:66:in `find_template'
/usr/share/foreman/app/controllers/hosts_controller.rb:528:in `block in template_used'
/usr/share/foreman/app/controllers/hosts_controller.rb:526:in `map'
/usr/share/foreman/app/controllers/hosts_controller.rb:526:in `template_used'
...
  Rendered common/500.html.erb (6.2ms)
Completed 500 Internal Server Error in 19ms (Views: 8.4ms | ActiveRecord: 2.8ms)

Debug information

Debug report uploaded to rsync://theforeman.org/debug-incoming as foreman-debug-xs9Vf.tar.xz.

I was able to get the templates to render correctly using this script:

scl enable ruby193 'ruby <<EOF
  require "mechanize" 

  domain = ENV["WAN_DOMAIN"]
  username = ENV["ADMIN_USERNAME"]
  password = ENV["ADMIN_PASSWORD"]

  agent = Mechanize.new
  agent.cert = "/var/lib/puppet/ssl/certs/foreman.#{domain}.pem" 
  agent.key = "/var/lib/puppet/ssl/private_keys/foreman.#{domain}.pem" 
  agent.agent.http.ca_file = "/var/lib/puppet/ssl/certs/ca.pem" 

  login_page = agent.get "https://foreman.#{domain}/users/login" 
  login_page.form_with(:action => "/users/login") do |form|
    form["login[login]"] = username
    form["login[password]"] = password
  end.submit

  host_page = agent.get "https://foreman.#{domain}/hosts/new" 
  host_page = host_page.form_with(:action => "/hosts") do |form|
    form["host[architecture_id]"] = 1
    form["host[location_id]"] = 1
  end.submit

  host_page = host_page.form_with(:action => "/hosts") do |form|
    form["host[operatingsystem_id]"] = 3
    form["host[location_id]"] = 1
  end.submit

  params = {}
  host_page = host_page.form_with(:action => "/hosts") do |form|
    form["host[medium_id]"] = 1
    form["host[operatingsystem_id]"] = 3
    form["host[architecture_id]"] = 1
    form["host[use_image]"] = false
  end.submit

  host_page.form_with(:action => "/hosts").fields.each do |field|
    params[field.name] = field.value
  end
  params["provisioning"] = "build" 

  page = agent.post("https://foreman.#{domain}/hosts/template_used", params)
  if page.link_with(:text => /Kickstart default PXELinux/).nil? ||
     page.link_with(:text => /Kickstart default finish/).nil? ||
     page.link_with(:text => /Kickstart default iPXE/).nil? ||
     page.link_with(:text => /Kickstart RHEL default/).nil? ||
     page.link_with(:text => /Kickstart default user data/).nil?
    puts "Failed" 
    exit 1
  else
    puts page.inspect
    exit 0
  end
EOF'

The difference between the working and failing cases seems to be where the operatingsystem_id is specified in the hash. In the passing case,
operatingsystem_id is specified as a key in the host hash. In the failing case, operatingsystem_id is specified as a key in the hostgroup
hash, which is a key parallel to the host key. That is:
  • Working: { "host" => { "operatingsystem_id" => 3 } }
  • Failing: { "host" => { }, "hostgroup" => { "operatingsystem_id" => 3 } }
Actions #1

Updated by Dominic Cleal over 9 years ago

  • Category set to Host creation
Actions

Also available in: Atom PDF