Project

General

Profile

Actions

Support #4184

closed

undefined method 'mask' for Safemode::Jail (NilClass)

Added by Chad Camp about 10 years ago. Updated about 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Triaged:
Fixed in Releases:
Found in Releases:

Description

I tried both host and generic and getting the same error about undefined mask.

I used a copy of the default script foreman script.
  • Invoke bootdisk:generate:host (first_time)
  • Invoke environment (first_time)
  • Execute environment
  • Execute bootdisk:generate:host
    rake aborted!
    undefined method 'mask' for Safemode::Jail (NilClass)
    /opt/rh/ruby193/root/usr/share/gems/gems/safemode-1.2.0/lib/safemode/jail.rb:17:in `method_missing'
    /opt/rh/ruby193/root/usr/share/gems/gems/safemode-1.2.0/lib/safemode.rb:79:in `bind'
    /opt/rh/ruby193/root/usr/share/gems/gems/safemode-1.2.0/lib/safemode.rb:51:in `eval'
    /opt/rh/ruby193/root/usr/share/gems/gems/safemode-1.2.0/lib/safemode.rb:51:in `eval'
    /usr/share/foreman/lib/foreman/renderer.rb:9:in `render_safe'
    /usr/share/foreman/lib/foreman/renderer.rb:52:in `unattended_render'
    /opt/rh/ruby193/root/usr/share/gems/gems/foreman_bootdisk-1.2.1/app/models/concerns/bootdisk/host_ext.rb:10:in `bootdisk_template_render'
    /opt/rh/ruby193/root/usr/share/gems/gems/foreman_bootdisk-1.2.1/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
    [root@svadm80 ~]# man isohybrid
    No manual entry for isohybrid
    [root@svadm80 ~]# foreman-rake bootdisk:generate:generic OUTPUT=/root/svops15.iso --trace
  • Invoke bootdisk:generate:generic (first_time)
  • Invoke environment (first_time)
  • Execute environment
  • Execute bootdisk:generate:generic
    rake aborted!
    Safemode doesn't allow to access 'constant' on URI
    /opt/rh/ruby193/root/usr/share/gems/gems/safemode-1.2.0/lib/safemode/parser.rb:123:in `raise_security_error'
    /opt/rh/ruby193/root/usr/share/gems/gems/safemode-1.2.0/lib/safemode/parser.rb:118:in `process_const'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:218:in `block (2 levels) in process'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:275:in `error_handler'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:217:in `block in process'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:340:in `in_context'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:194:in `process'
    /opt/rh/ruby193/root/usr/share/gems/gems/safemode-1.2.0/lib/safemode/parser.rb:131:in `process_call_receiver'
    /opt/rh/ruby193/root/usr/share/gems/gems/safemode-1.2.0/lib/safemode/parser.rb:36:in `process_call'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:218:in `block (2 levels) in process'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:275:in `error_handler'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:217:in `block in process'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:340:in `in_context'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:194:in `process'
    /opt/rh/ruby193/root/usr/share/gems/gems/ruby2ruby-2.0.1/lib/ruby2ruby.rb:558:in `process_lasgn'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:218:in `block (2 levels) in process'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:275:in `error_handler'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:217:in `block in process'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:340:in `in_context'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:194:in `process'
    /opt/rh/ruby193/root/usr/share/gems/gems/ruby2ruby-2.0.1/lib/ruby2ruby.rb:152:in `process_block'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:218:in `block (2 levels) in process'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:275:in `error_handler'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:217:in `block in process'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:340:in `in_context'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:194:in `process'
    /opt/rh/ruby193/root/usr/share/gems/gems/safemode-1.2.0/lib/safemode/parser.rb:131:in `process_call_receiver'
    /opt/rh/ruby193/root/usr/share/gems/gems/safemode-1.2.0/lib/safemode/parser.rb:36:in `process_call'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:218:in `block (2 levels) in process'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:275:in `error_handler'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:217:in `block in process'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:340:in `in_context'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:194:in `process'
    /opt/rh/ruby193/root/usr/share/gems/gems/safemode-1.2.0/lib/safemode/parser.rb:144:in `process_call_args'
    /opt/rh/ruby193/root/usr/share/gems/gems/safemode-1.2.0/lib/safemode/parser.rb:38:in `process_call'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:218:in `block (2 levels) in process'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:275:in `error_handler'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:217:in `block in process'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:340:in `in_context'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:194:in `process'
    /opt/rh/ruby193/root/usr/share/gems/gems/ruby2ruby-2.0.1/lib/ruby2ruby.rb:152:in `process_block'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:218:in `block (2 levels) in process'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:275:in `error_handler'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:217:in `block in process'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:340:in `in_context'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:194:in `process'
    /opt/rh/ruby193/root/usr/share/gems/gems/ruby2ruby-2.0.1/lib/ruby2ruby.rb:508:in `process_iter'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:218:in `block (2 levels) in process'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:275:in `error_handler'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:217:in `block in process'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:340:in `in_context'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:194:in `process'
    /opt/rh/ruby193/root/usr/share/gems/gems/ruby2ruby-2.0.1/lib/ruby2ruby.rb:152:in `process_block'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:218:in `block (2 levels) in process'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:275:in `error_handler'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:217:in `block in process'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:340:in `in_context'
    /opt/rh/ruby193/root/usr/share/gems/gems/sexp_processor-4.1.3/lib/sexp_processor.rb:194:in `process'
    /opt/rh/ruby193/root/usr/share/gems/gems/safemode-1.2.0/lib/safemode/parser.rb:10:in `jail'
    /opt/rh/ruby193/root/usr/share/gems/gems/safemode-1.2.0/lib/safemode.rb:49:in `eval'
    /usr/share/foreman/lib/foreman/renderer.rb:9:in `render_safe'
    /opt/rh/ruby193/root/usr/share/gems/gems/foreman-katello-engine-0.0.17/lib/foreman_katello_engine/renderer.rb:11:in `unattended_render'
    /opt/rh/ruby193/root/usr/share/gems/gems/foreman_bootdisk-1.2.1/app/services/bootdisk/renderer.rb:9:in `generic_template_render'
    /opt/rh/ruby193/root/usr/share/gems/gems/foreman_bootdisk-1.2.1/lib/tasks/bootdisk.rake:17: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:generic
foreman-rake bootdisk:generate:host NAME=svops15.wishard.edu OUTPUT=/root/svops15.iso --trace

Is there any other info I should post to help?


Related issues 2 (1 open1 closed)

Related to Foreman - Bug #2948: Whitelist additional Provisioning Template MacrosClosedLukas Zapletal08/19/2013Actions
Related to Boot disk - Bug #4195: Bootdisk fails to provision if root url is setNewActions
Actions #1

Updated by Chad Camp about 10 years ago

I have checked and I have the 2 gems listed installed as well as dependencies listed on the plugin page.

Actions #2

Updated by Dominic Cleal about 10 years ago

  • Status changed from New to Feedback

Please disable safemode under More>Settings>Provisioning>safemode_render.

Actions #3

Updated by Chad Camp about 10 years ago

I disabled safemode_render and I am now able to generate the generic .iso. I get the following when doing the host specific version:

]# foreman-rake bootdisk:generate:host NAME=svops15 OUTPUT=/tmp/svops15.iso --trace
  • Invoke bootdisk:generate:host (first_time)
  • Invoke environment (first_time)
  • Execute environment
  • Execute bootdisk:generate:host
    rake aborted!
    undefined method `mask' for nil:NilClass
    (erb):22:in `render_safe'
    /opt/rh/ruby193/root/usr/share/ruby/erb.rb:838:in `eval'
    /opt/rh/ruby193/root/usr/share/ruby/erb.rb:838:in `result'
    /usr/share/foreman/lib/foreman/renderer.rb:12:in `render_safe'
    /usr/share/foreman/lib/foreman/renderer.rb:52:in `unattended_render'
    /opt/rh/ruby193/root/usr/share/gems/gems/foreman_bootdisk-1.2.1/app/models/concerns/bootdisk/host_ext.rb:10:in `bootdisk_template_render'
    /opt/rh/ruby193/root/usr/share/gems/gems/foreman_bootdisk-1.2.1/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
Actions #4

Updated by Dominic Cleal about 10 years ago

This is probably because the host has no subnet selected - check when editing the host, that there's a subnet and IP entered on the Network tab.

I released foreman_bootdisk 2.0.0 (compatible only with Foreman 1.4) this week, which adds some better error messages in for this condition too.

Actions #5

Updated by Chad Camp about 10 years ago

Also when I try the generic iso to provision the server I get an error that it cannot find the address.

...
http://svadm80.domain.com/unattended/gPXE&mac=74%3A46%3Aa0%3Aa8%3Aab%3Acd... No such file or directory

Shouldn't this be http://svadm80.domain.com/*_foreman_*/unattended/gPXE....

Actions #6

Updated by Chad Camp about 10 years ago

well the text coding didn't work. I was trying to put foreman in bold/italics for emphasis.

Actions #7

Updated by Dominic Cleal about 10 years ago

Yes, that's #4195, it doesn't work when Foreman's hosted at a non-root prefix. You might be able to work around this by editing the foreman_url call in the template, e.g.

<%= foreman_url("gPXE").sub("domain.com", "domain.com/foreman") %>

(note to edit a template, copy the contents to your own template, then under More>Settings>Bootdisk you can set the name of the template to use - this is so your changes aren't overwritten on upgrade.)

Actions #8

Updated by Chad Camp about 10 years ago

Looks like I am running katello-foreman-all.noarch 1.4.6-64.el6sat. Does the new plugin work with that version?

Yeah I don't have any subnets to select. The dropdown is greyed out so I will have to see how to fill those in.

I will also try to the template fix.

Actions #9

Updated by Dominic Cleal about 10 years ago

Chad Camp wrote:

Looks like I am running katello-foreman-all.noarch 1.4.6-64.el6sat. Does the new plugin work with that version?

2.0.0 won't, I'm not sure if upgrading to Foreman 1.4 on a Katello 1.4 installation will work or not.

Yeah I don't have any subnets to select. The dropdown is greyed out so I will have to see how to fill those in.

You should find them under More>Provisioning>Subnets. It's this data which is baked into the host-specific ISO image so the host knows what its name servers, gateway etc are when booting without DHCP.

Actions #10

Updated by Dominic Cleal about 10 years ago

Dominic Cleal wrote:

Chad Camp wrote:

Looks like I am running katello-foreman-all.noarch 1.4.6-64.el6sat. Does the new plugin work with that version?

2.0.0 won't, I'm not sure if upgrading to Foreman 1.4 on a Katello 1.4 installation will work or not.

Actually, I'd recommend against 1.4.0 anyway for now, since #3903 is a known issue and would affect you.

Actions #11

Updated by Chad Camp about 10 years ago

OK, the host build is now making an .iso with adding the subnet info., but cannot set the DNS (invalid paramater) when booting from the CD.

The generic .iso is still cutting off the foreman from the url. Here is what the changed generic template line looks like. I just copied and pasted the generic template and only made this change.

chain <%= (u = URI.parse(foreman_url("gPXE").sub("domain.com", "domain.com/foreman")); u.query = "#{u.query}&mac="; u.to_s) >${net<= i ->/mac} || goto net<= i+1 %>

Actions #12

Updated by Dominic Cleal about 10 years ago

Chad Camp wrote:

OK, the host build is now making an .iso with adding the subnet info., but cannot set the DNS (invalid paramater) when booting from the CD.

That sounds like a bug fixed in version 1.2.3, and I see you're on 1.2.1. The ISO was setting multiple DNS servers while iPXE was only capable of configuring one - so as a workaround, remove the secondary DNS server from the subnet or edit the host template and remove the dns_secondary portion.

Actions #13

Updated by Dominic Cleal about 10 years ago

  • Related to Bug #2948: Whitelist additional Provisioning Template Macros added
Actions #14

Updated by Dominic Cleal about 10 years ago

  • Related to Bug #4195: Bootdisk fails to provision if root url is set added
Actions #15

Updated by Chad Camp about 10 years ago

Looks like I will have to try to update to 1.2.3. I have tried a few different variations to get the url correct and it is not changing at all.

Actions #16

Updated by Chad Camp about 10 years ago

what is my best upgrade path?

1. yum remove ruby193-rubygem-foreman_bootdisk
2. any DB cleanup?

3. follow the Foreman instructions for installing updated plugin.

Actions #17

Updated by Dominic Cleal about 10 years ago

Note the URL prefix issue isn't fixed in any version, only the DNS invalid parameter error, so I don't know how much that helps you (given you can edit the template to fix the DNS issue).

To upgrade though, just yum upgrade to the version in this repo: http://yum.theforeman.org/plugins/1.3/el6/x86_64/

Actions #18

Updated by Dominic Cleal about 10 years ago

  • Status changed from Feedback to Closed

I've improved the error handling both in 2.0.0 and have just added another check for the safemode setting, which was in the original description.

Actions

Also available in: Atom PDF