Provisioning using Red Hat Satellite 6 fails with error undefined method '#params' for Host::Managed::Jail.

Solution Verified - Updated -

Environment

  • Red Hat Satellite 6.4.

Issue

  • Not able to provision VM's after upgrading Red Hat Satellite 6.

  • Getting error "undefined method '#params' for Host::Managed::Jail" when provisioning a VM using Red Hat Satellite 6.

Resolution

  • Follow below steps on the Red Hat Satellite server to resolve the issue:

  • After upgrading Satellite to version 6.4, customized or cloned templates requires a modification.

    @host.params['parameter1'] -> host_param('parameter1')
    @host.param_true?('parameter1') -> host_param_true?('parameter1')
    @host.param_false?('parameter1') -> host_param_false?('parameter1')
    @host.info['parameters']['realm']  -> host_enc['parameters']['realm']
    
  • The process uses simple text replacement which will not work in all cases, e.g. when host is assigned to a variable:

     myhost = @host
     myhost.params['wont_work']
    
  • After upgrade Satellite to version 6.4, please verify all templates, parameters, lookup keys and values of the old-syntax and replace them manually. Following error is seen when using old style templates.

    undefined method '#params' for Host::Managed::Jail
    

Root Cause

  • Red Hat Satellite 6.4 upgrade process automatically tries to find macros which has been deprecated and convert them into new syntax for all templates, parameters and lookup keys and values but this is done only for read-only (default) templates. All customized templates need to be modified manually.

Diagnostic Steps

  • Following error can be seen in /var/log/foreman/production.log.
2018-04-29T08:11:03 [W|app|eac4b] There was an error rendering the Satellite Kickstart Default Finish template:
 | ActionView::Template::Error: undefined method '#params' for Host::Managed::Jail (Host::Managed)
 | /opt/theforeman/tfm/root/usr/share/gems/gems/safemode-1.3.4/lib/safemode/jail.rb:22:in `method_missing'
 | Satellite Kickstart Default Finish:66:in `bind'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/safemode-1.3.4/lib/safemode.rb:51:in `eval'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/safemode-1.3.4/lib/safemode.rb:51:in `eval'
 | /usr/share/foreman/lib/foreman/renderer.rb:128:in `render_safe'
 | /usr/share/foreman/lib/foreman/renderer.rb:246:in `unattended_render'

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

4 Comments

I Don't really like the idea " replace manually". Do you have any helper scripts for debugging?

Hello,

I have made all of the necessary changes but still get this error when this snippet is reached. I changed the @host.info to host_enc but there is still something in this block that isn't working. Still trying to dig into it, but if anybody could possibly take a look here and help, it would be greatly appreciated. Thank you!

<%= snippet "subscription_manager_registration" %>

<% if host_enc['parameters']['realm'] && @host.realm && @host.realm.realm_type == 'Red Hat Identity Management' -%> <%= snippet "idm_register" %> <% end -%>

Hi Alexander,

Is the error still '#params' for Host::Managed::Jail?

Did you change the syntax in "subscription_manager_registration" snippet too? It has a reference @host.params['kt_activation_keys'].

/var/log/foreman/production.log, will tell if issue is with any of the snippets.

A support case will help to identify faster.

Hi Rohan,

I did not realize it was referencing another template there. I found that template and will try correcting the syntax. Thank you very much for looking into this. I will report back when I have corrected all referenced templates.