Problem:
Following issue was discovered in Red Hat Satellite 6.15.3 and 6.15.4, that uses the Foreman templates as well.
The template snippet “redhat_register” used in “Cloudinit Default” results in an error.
This is caused by the template snippet “subscription_manager_setup” used in “redhat_register”.
In the original redhat_register (foreman/app/views/unattended/provisioning_templates/snippet/redhat_register.erb at develop · theforeman/foreman · GitHub):
<%= snippet("subscription_manager_setup", variables: { subman_setup_scenario: 'provisioning' }).strip -%>
does not follow the indentation in a correct way, exmpl:
#cloud-config
...
- |
echo "##############################################################"
echo "################# SUBSCRIPTION MANAGER #######################"
echo "##############################################################"
echo
echo "Starting the subscription-manager registration process"
# Set up subscription-manager
# Select package manager for the OS (sets the $PKG_MANAGER* variables)
if [ -z "$PKG_MANAGER" ]; then
if [ -f /etc/os-release ] ; then
. /etc/os-release
fi
...
Resolution
By applying following modification in redhat_register, using “indent(2) { < snippet > }”
<%= indent(2) { snippet("subscription_manager_setup", variables: { subman_setup_scenario: 'provisioning' }).strip } -%>
results in the expected working solution:
#cloud-config
...
- |
echo "##############################################################"
echo "################# SUBSCRIPTION MANAGER #######################"
echo "##############################################################"
echo
echo "Starting the subscription-manager registration process"
# Set up subscription-manager
# Select package manager for the OS (sets the $PKG_MANAGER* variables)
if [ -z "$PKG_MANAGER" ]; then
if [ -f /etc/os-release ] ; then
. /etc/os-release
fi
...
Expected outcome:
See above
Foreman and Proxy versions:
Foreman and Proxy plugin versions:
Distribution and version:
Other relevant data: