Bug 1136369 - `foreman-rake bootdisk:generate:host NAME=foobarbaz.katellolabs.org` fails with "undefined method 'empty?' for NilClass::Jail (NilClass)"
Summary: `foreman-rake bootdisk:generate:host NAME=foobarbaz.katellolabs.org` fails wi...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Provisioning
Version: 6.0.3
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: Dominic Cleal
QA Contact: Tazim Kolhar
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-09-02 12:47 UTC by Jan Hutař
Modified: 2019-07-11 08:10 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-08-12 05:16:01 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:1592 0 normal SHIPPED_LIVE Important: Red Hat Satellite 6.1.1 on RHEL 6 2015-08-12 09:04:35 UTC

Description Jan Hutař 2014-09-02 12:47:59 UTC
Description of problem:
`foreman-rake bootdisk:generate:host NAME=foobarbaz.katellolabs.org` fails with "undefined method 'empty?' for NilClass::Jail (NilClass)"


Version-Release number of selected component (if applicable):
Satellite-6.0.4-RHEL-6-20140829.0


How reproducible:
1 of 1 attempt


Steps to Reproduce:
1. Sync RHEL6 and RHEL6 RH Common Red Hat repos
2. Create content view and publish it to the Library
3. Create new host with some random values
4. # foreman-rake bootdisk:generate:host NAME=foobarbaz.katellolabs.org --trace


Actual results:
# foreman-rake bootdisk:generate:host NAME=foobarbaz.katellolabs.org --trace
** Invoke bootdisk:generate:host (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute bootdisk:generate:host
rake aborted!
undefined method 'empty?' for NilClass::Jail (NilClass)
/opt/rh/ruby193/root/usr/share/gems/gems/safemode-1.2.1/lib/safemode/jail.rb:17:in `method_missing'
/opt/rh/ruby193/root/usr/share/gems/gems/safemode-1.2.1/lib/safemode.rb:53:in `bind'
/opt/rh/ruby193/root/usr/share/gems/gems/safemode-1.2.1/lib/safemode.rb:51:in `eval'
/opt/rh/ruby193/root/usr/share/gems/gems/safemode-1.2.1/lib/safemode.rb:51:in `eval'
/usr/share/foreman/lib/foreman/renderer.rb:20:in `render_safe'
/usr/share/foreman/lib/foreman/renderer.rb:74:in `unattended_render'
/opt/rh/ruby193/root/usr/share/gems/gems/foreman_bootdisk-2.0.6/app/models/concerns/bootdisk/host_ext.rb:16:in `bootdisk_template_render'
/opt/rh/ruby193/root/usr/share/gems/gems/foreman_bootdisk-2.0.6/lib/tasks/bootdisk.rake:6:in `block (3 levels) in <top (required)>'
/opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:205:in `call'
/opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:205:in `block in execute'
/opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:200:in `each'
/opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:200:in `execute'
/opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:158:in `block in invoke_with_call_chain'
/opt/rh/ruby193/root/usr/share/ruby/monitor.rb:211:in `mon_synchronize'
/opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:151:in `invoke_with_call_chain'
/opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:144:in `invoke'
/opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:116:in `invoke_task'
/opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:94:in `block (2 levels) in top_level'
/opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:94:in `each'
/opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:94:in `block in top_level'
/opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:133:in `standard_exception_handling'
/opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:88:in `top_level'
/opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:66:in `block in run'
/opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:133:in `standard_exception_handling'
/opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:63:in `run'
/opt/rh/ruby193/root/usr/bin/rake:32:in `<main>'
Tasks: TOP => bootdisk:generate:host


Expected results:
ISO should be created or useful error message should be printed

Comment 1 RHEL Program Management 2014-09-02 13:02:57 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 3 Lukas Zapletal 2014-09-02 13:32:39 UTC
Jan, this is known behavior. You need to turn off safemode_render value (to false) in main Settings.

[root@dell-pe2950-01 tmp]# foreman-rake bootdisk:generate:host NAME=fsdfsdf.katellolabs.org OUTPUT=/tmp/test.iso
Size of boot image is 4 sectors -> No emulation
Total translation table size: 2048
Total rockridge attributes bytes: 0
Total directory bytes: 0
Path table size(bytes): 10
Max brk space used 0
339 extents written (0 MB)
Wrote /tmp/test.iso

We should report it maybe better. I'd go for doco only maybe if you like.

Created upstream low prio task: http://projects.theforeman.org/issues/7327

Comment 4 RHEL Program Management 2014-09-02 13:35:49 UTC
Development Management has reviewed and declined this request.
You may appeal this decision by reopening this request.

Comment 5 Lukas Zapletal 2014-09-02 13:39:01 UTC
Ok I am taking it back, this does work even when safemode is turned on.

But I am unable to reproduce, see above. Works for me.

Have you edited the template?

Comment 6 Dominic Cleal 2014-09-02 13:41:18 UTC
Looking at the error, I'd suggest it's hitting one of these three tests and failing:

app/views/foreman_bootdisk/host.erb
8:bootdisk_raise(N_('Host has no IP address defined')) if @host.ip.empty?
11:bootdisk_raise(N_('Subnet (%s) has no gateway defined'), @host.subnet) if @host.subnet.gateway.empty?
12:bootdisk_raise(N_('Subnet (%s) has no primary DNS server defined'), @host.subnet) if @host.subnet.dns_primary.empty?

So the issue is that either the IP, subnet's gateway or DNS primary server isn't specified.

That a safemode error is given is a bug, somewhere.

Comment 7 Dominic Cleal 2014-09-03 11:57:01 UTC
To reproduce, note that either:

a) the host must have no IP address given
b) the subnet must have no gateway or primary DNS

What's more, they must be nil rather than empty strings - probably creating them through the API or CLI, rather than the UI will do this.

Comment 8 Jan Hutař 2014-09-03 19:17:23 UTC
Yes, that makes sense. But I'm pretty sure I have used webUI to create the host and I have set minimum things I could to make it create new host (e.g. I'm pretty sure I have not fully filled subnet).

Comment 12 Tazim Kolhar 2015-03-26 13:17:12 UTC
VERIFIED:

# rpm -qa | grep foreman
foreman-debug-1.7.2.13-1.el7sat.noarch
ruby193-rubygem-foreman_hooks-0.3.7-2.el7sat.noarch
rubygem-hammer_cli_foreman-0.1.4.6-1.el7sat.noarch
foreman-ovirt-1.7.2.13-1.el7sat.noarch
foreman-proxy-1.7.2.4-1.el7sat.noarch
dhcp201-150.englab.pnq.redhat.com-foreman-client-1.0-1.noarch
dhcp201-150.englab.pnq.redhat.com-foreman-proxy-1.0-2.noarch
rubygem-hammer_cli_foreman_discovery-0.0.1.3-1.el7sat.noarch
foreman-compute-1.7.2.13-1.el7sat.noarch
foreman-libvirt-1.7.2.13-1.el7sat.noarch
ruby193-rubygem-foreman_docker-1.2.0.6-1.el7sat.noarch
ruby193-rubygem-foreman-redhat_access-0.0.9-1.el7sat.noarch
foreman-selinux-1.7.2.8-1.el7sat.noarch
dhcp201-150.englab.pnq.redhat.com-foreman-proxy-client-1.0-1.noarch
foreman-discovery-image-2.1.0-9.el7sat.noarch
rubygem-hammer_cli_foreman_bootdisk-0.1.2.5-1.el7sat.noarch
foreman-vmware-1.7.2.13-1.el7sat.noarch
ruby193-rubygem-foreman-tasks-0.6.12.3-1.el7sat.noarch
ruby193-rubygem-foreman_gutterball-0.0.1.9-1.el7sat.noarch
ruby193-rubygem-foreman_bootdisk-4.0.2.9-1.el7sat.noarch
foreman-gce-1.7.2.13-1.el7sat.noarch
foreman-1.7.2.13-1.el7sat.noarch
ruby193-rubygem-foreman_discovery-2.0.0.8-1.el7sat.noarch
foreman-postgresql-1.7.2.13-1.el7sat.noarch
rubygem-hammer_cli_foreman_tasks-0.0.3.3-1.el7sat.noarch

Comment 13 Johan Swensson 2015-06-23 11:42:00 UTC
I ran in to this when the subnet did not have any DNS servers provided. The error went away after adding at least a primary DNS on the subnet.

Comment 14 Bryan Kearney 2015-08-11 13:24:33 UTC
This bug is slated to be released with Satellite 6.1.

Comment 15 errata-xmlrpc 2015-08-12 05:16:01 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2015:1592


Note You need to log in before you can comment on or make changes to this bug.