Bug 1132133

Summary: ISE when clicking New Host or All Hosts (Hardware Models)
Product: Red Hat Satellite Reporter: Shannon Hughes <shughes>
Component: WebUIAssignee: Katello Bug Bin <katello-bugs>
WebUI sub component: Katello QA Contact: Katello QA List <katello-qa-list>
Status: CLOSED DUPLICATE Docs Contact:
Severity: unspecified    
Priority: unspecified CC: ahumbe, bhamrick, dcleal, xdmoon
Version: 6.0.3   
Target Milestone: Unspecified   
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-16 16:19:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1115190    

Description Shannon Hughes 2014-08-20 18:23:01 UTC
Description of problem:

Built new sat6 and tried to build a client system using PXE but it did not work (Do not have the exact customer problem/error). Deleted Host Group, activation key, host collection, content view, life cycle environment and created new .


When customer clicks on either Hosts->New host, or Hosts->All hosts->New Host
- Fails with error:

Error
undefined method `id' for nil:NilClass 

NoMethodError
undefined method `id' for nil:NilClass
app/views/hosts/_form.html.erb:119:in `block (3 levels) in
_app_views_hosts__form_html_erb___2517794720616716771_126236580'
app/helpers/layout_helper.rb:159:in `block (3 levels) in field'
app/helpers/layout_helper.rb:158:in `block (2 levels) in field'
app/helpers/layout_helper.rb:149:in `block in field'
app/helpers/layout_helper.rb:148:in `field'
app/views/hosts/_form.html.erb:118:in `block (2 levels) in
_app_views_hosts__form_html_erb___2517794720616716771_126236580'
app/helpers/layout_helper.rb:250:in `form_for'
app/views/hosts/_form.html.erb:8:in `block in
_app_views_hosts__form_html_erb___2517794720616716771_126236580'
app/models/taxonomy.rb:48:in `block (2 levels) in as_taxonomy'
app/models/concerns/foreman/thread_session.rb:143:in `as_location'
app/models/taxonomy.rb:47:in `block in as_taxonomy'
app/models/concerns/foreman/thread_session.rb:108:in `as_org'
app/models/taxonomy.rb:46:in `as_taxonomy'
app/views/hosts/_form.html.erb:6:in
`_app_views_hosts__form_html_erb___2517794720616716771_126236580'
app/views/hosts/new.html.erb:7:in
`_app_views_hosts_new_html_erb___1307166877427700607_126365180'
app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
lib/middleware/catch_json_parse_errors.rb:9:in `call' 

Possible Hardware Models might be coming into play from code: 

From the code we see references to this foreman feature: 

<%= select_f f, :model_id, Model.all, :id, :to_label, { :include_blank => true }, {:label =>

_("Hardware Model")} unless @host.compute_resource_id%>

Comment 1 RHEL Program Management 2014-08-20 18:33:07 UTC
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 5 Dominic Cleal 2014-09-16 16:19:02 UTC
Complete stack trace from production.log:

Operation FAILED: undefined method `id' for nil:NilClass
/opt/rh/ruby193/root/usr/share/gems/gems/katello-1.5.0/app/helpers/katello/hosts_and_hostgroups_helper.rb:45:in `block (2 levels) in grouped_env_options'
/opt/rh/ruby193/root/usr/share/gems/gems/katello-1.5.0/app/helpers/katello/hosts_and_hostgroups_helper.rb:39:in `map'
/opt/rh/ruby193/root/usr/share/gems/gems/katello-1.5.0/app/helpers/katello/hosts_and_hostgroups_helper.rb:39:in `block in grouped_env_options'
/opt/rh/ruby193/root/usr/share/gems/gems/katello-1.5.0/app/helpers/katello/hosts_and_hostgroups_helper.rb:29:in `map'
/opt/rh/ruby193/root/usr/share/gems/gems/katello-1.5.0/app/helpers/katello/hosts_and_hostgroups_helper.rb:29:in `grouped_env_options'
/usr/share/foreman/app/views/hosts/_form.html.erb:119:in `block (3 levels) in _app_views_hosts__form_html_erb___3704410781509911512_133078460'
/usr/share/foreman/app/helpers/layout_helper.rb:159:in `block (3 levels) in field'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_view/helpers/capture_helper.rb:40:in `block in capture'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_view/helpers/capture_helper.rb:187:in `with_output_buffer'
/opt/rh/ruby193/root/usr/share/gems/gems/haml-3.1.6/lib/haml/helpers/xss_mods.rb:109:in `with_output_buffer_with_haml_xss'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_view/helpers/capture_helper.rb:40:in `capture'
/opt/rh/ruby193/root/usr/share/gems/gems/haml-3.1.6/lib/haml/helpers/action_view_mods.rb:105:in `capture_with_haml'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_view/helpers/tag_helper.rb:95:in `content_tag'
/opt/rh/ruby193/root/usr/share/gems/gems/haml-3.1.6/lib/haml/helpers/action_view_mods.rb:115:in `content_tag_with_haml'
/usr/share/foreman/app/helpers/layout_helper.rb:158:in `block (2 levels) in field'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_view/helpers/capture_helper.rb:40:in `block in capture'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_view/helpers/capture_helper.rb:187:in `with_output_buffer'
/opt/rh/ruby193/root/usr/share/gems/gems/haml-3.1.6/lib/haml/helpers/xss_mods.rb:109:in `with_output_buffer_with_haml_xss'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_view/helpers/capture_helper.rb:40:in `capture'
/opt/rh/ruby193/root/usr/share/gems/gems/haml-3.1.6/lib/haml/helpers/action_view_mods.rb:105:in `capture_with_haml'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_view/helpers/tag_helper.rb:95:in `content_tag'
/opt/rh/ruby193/root/usr/share/gems/gems/haml-3.1.6/lib/haml/helpers/action_view_mods.rb:115:in `content_tag_with_haml'
/usr/share/foreman/app/helpers/layout_helper.rb:149:in `block in field'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_view/helpers/capture_helper.rb:40:in `block in capture'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_view/helpers/capture_helper.rb:187:in `with_output_buffer'
/opt/rh/ruby193/root/usr/share/gems/gems/haml-3.1.6/lib/haml/helpers/xss_mods.rb:109:in `with_output_buffer_with_haml_xss'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_view/helpers/capture_helper.rb:40:in `capture'
/opt/rh/ruby193/root/usr/share/gems/gems/haml-3.1.6/lib/haml/helpers/action_view_mods.rb:105:in `capture_with_haml'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_view/helpers/tag_helper.rb:95:in `content_tag'
/opt/rh/ruby193/root/usr/share/gems/gems/haml-3.1.6/lib/haml/helpers/action_view_mods.rb:115:in `content_tag_with_haml'
/usr/share/foreman/app/helpers/layout_helper.rb:148:in `field'
/usr/share/foreman/app/views/hosts/_form.html.erb:118:in `block (2 levels) in _app_views_hosts__form_html_erb___3704410781509911512_133078460'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_view/helpers/capture_helper.rb:40:in `block in capture'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_view/helpers/capture_helper.rb:187:in `with_output_buffer'
/opt/rh/ruby193/root/usr/share/gems/gems/haml-3.1.6/lib/haml/helpers/xss_mods.rb:109:in `with_output_buffer_with_haml_xss'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_view/helpers/capture_helper.rb:40:in `capture'
/opt/rh/ruby193/root/usr/share/gems/gems/haml-3.1.6/lib/haml/helpers/action_view_mods.rb:105:in `capture_with_haml'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_view/helpers/form_helper.rb:607:in `fields_for'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_view/helpers/form_helper.rb:378:in `form_for'
/opt/rh/ruby193/root/usr/share/gems/gems/haml-3.1.6/lib/haml/helpers/action_view_mods.rb:183:in `form_for_with_haml'
/opt/rh/ruby193/root/usr/share/gems/gems/haml-3.1.6/lib/haml/helpers/xss_mods.rb:132:in `form_for_with_haml_xss'
/usr/share/foreman/app/helpers/layout_helper.rb:250:in `form_for'
/usr/share/foreman/app/views/hosts/_form.html.erb:8:in `block in _app_views_hosts__form_html_erb___3704410781509911512_133078460'
/usr/share/foreman/app/models/taxonomy.rb:48:in `block (2 levels) in as_taxonomy'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:143:in `as_location'
/usr/share/foreman/app/models/taxonomy.rb:47:in `block in as_taxonomy'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:108:in `as_org'
/usr/share/foreman/app/models/taxonomy.rb:46:in `as_taxonomy'
/usr/share/foreman/app/views/hosts/_form.html.erb:6:in `_app_views_hosts__form_html_erb___3704410781509911512_133078460'

Packages:
foreman-1.6.0.21-1.el6sat.noarch
foreman-compute-1.6.0.21-1.el6sat.noarch
foreman-gce-1.6.0.21-1.el6sat.noarch
foreman-libvirt-1.6.0.21-1.el6sat.noarch
foreman-ovirt-1.6.0.21-1.el6sat.noarch
foreman-postgresql-1.6.0.21-1.el6sat.noarch
foreman-proxy-1.6.0.9-1.el6sat.noarch
foreman-selinux-1.6.0-5.el6sat.noarch
foreman-vmware-1.6.0.21-1.el6sat.noarch
katello-1.5.0-26.el6sat.noarch
katello-ca-1.0-1.noarch
katello-certs-tools-1.5.5-1.el6sat.noarch
katello-installer-0.0.53-1.el6sat.noarch
pulp-katello-0.3-3.el6sat.noarch
ruby193-rubygem-foreman_bootdisk-2.0.6-1.1.el6sat.noarch
ruby193-rubygem-foreman_discovery-1.3.0-0.1.rc2.el6sat.noarch
ruby193-rubygem-foreman_hooks-0.3.5-2.el6sat.noarch
ruby193-rubygem-foreman-redhat_access-0.0.4-1.el6sat.noarch
ruby193-rubygem-foreman-tasks-0.6.3-2.el6sat.noarch
ruby193-rubygem-katello-1.5.0-65.el6sat.noarch
rubygem-hammer_cli_foreman-0.1.1-9.el6sat.noarch
rubygem-hammer_cli_foreman_tasks-0.0.3-2.el6sat.noarch
rubygem-hammer_cli_katello-0.0.4-7.el6sat.noarch

This appears to be bug #1112777.  Please try using Satellite 6.0 GA.

*** This bug has been marked as a duplicate of bug 1112777 ***