Provisioning template preview is blank and no hosts listed

Preview function for provisioning templates is blank and the filter host dropdown list is blank.

Expected outcome:
Ability to preview a rendered template

Foreman and Proxy versions:
Foreman/Proxy 3.1

Foreman and Proxy plugin versions:
foreman-tasks: 5.2.0
foreman_puppet: 2.0.0
foreman-remote_execution: 5.0.1
foreman_setup: 7.0.0
katello: 4.3.0rc4

Distribution and version:
Rocky Linux 8.5

Other relevant data:
Attempted to preview the default Global Registration and Linux host_init_config as well as clones. Currently only one host is registered (aside from the foreman host itself) but neither host shows up in the list.

Hi, if I remember correctly, preview mode is enabled only for the managed hosts.

Your registered hosts are not managed by Foreman therefore they are not in the list.

Thinking about this it does make sense for the provisioning templates, but for the registration & host_init_config templates we should list un-managed hosts as well. I’ll look into it.

1 Like

Yes, you are correct. As soon as I set it to managed, the host did show up but other errors appeared:

There was an error rendering the Global Registration clone template: undefined method '#login' for NilClass::Jail (NilClass)

It would make sense to have the ability to preview for unmanaged hosts otherwise it’s a lot of back-and-forth and resetting the host and foreman to test out changes and new steps for these templates.

Thanks for the help!

And PR [0] have been merged with following changes:

  • Make Global registration template previewable
  • Do not require host selection for registration templates
  • Show managed & unmanaged hosts for host_init_config template preview

[0] Registration and host_init_config templates previews by stejskalleos · Pull Request #9033 · theforeman/foreman · GitHub