Problem:
Some occasions @host.single_lifecycle_environment and @host.single_content_view macros are rendering as empty/blank in my kickstart templates.
If I refresh the template it renders as expected on one attempt and render as blank on another attempt.
I have noticed this after upgrading from Foreman version 3.5.2 to 3.6.1 and updating templates (@host.content_view → @host.single_content_view and @host.lifecycle_environment → @host.single_lifecycle_environment)
In foreman log also no errors identified ( both Foreman and the smart proxy rendering the template)
Expected outcome:
Rendering life cycle environment and content view in templates (kickstart in this case)
Foreman and Proxy versions:
Foreman 3.6.1
Foreman and Proxy plugin versions:
Katello 4.8.1
Distribution and version:
Other relevant data:
single_content_view
and single_lifecycle_environment
return nil
only if the host has no content view environments assigned. maybe adding .reload
would help?
@host.reload.single_content_view
but I’m not sure that’s available in safe mode.
Do you have reproducer steps so I can check it out? Are you using one of the predefined templates or a custom one?
I have updated (just select and save) content view of all Host groups.
Still it’s showing as empty in UI even after the update.
So far templates are rendering without any issues.
I’m closely monitoring with our team who are responsible creating and re-building hosts.
As per them they haven’t faced this issue with newly created hosts and faced only with rebuilding existing hosts.
Myself also tried only with rebuilding existing hosts in our Dev environment.
We’re a retail supermarket chain so daily we have to build/rebuild few POS PCs.
This is a custom template.
What I did was upgrading Foreman version 3.5.2 to 3.6.1 along with Katello to 4.8.1 (cannot remember the minor version of 4.7.x), update templates with single_content_view and single_lifecycle_environment, sync repos and publish a new version (Fedora 37 & Puppet in this case).
We already have a similar Foreman server ( 3.5.3 and Katello 4.7.5 ) which is using to update/upgrade and check compatibilities prior to update/upgrade the production Foreman server. This time we’ve override our usual process and go ahead straight with the production server. I’ll also reproduce this issue with it and share the result.
Ah… If your hosts are assigned to hostgroups, having Bug #36498: Editing a host results in an error "content_view_id and lifecycle_environment_id must be provided together" - Katello - Foreman may help.
That fix is in Katello 4.8.2 and 4.9.0, releasing imminently.
Until that upgrade is available, see if assigning both a content view and lifecycle environment to the hostgroup helps.
Thanks a lot.
After updating content view on Host groups (lifecycle environment was already there) so far templates getting rendered without any issues.
We’ll do so and update Katello as soon as 4.8.2 get released.
1 Like