So adding the if statement to the activation_key global parameter eliminates the error.
I commented out the snippet inclusion for redhat_register and tried to create a new host without the <% if @host.operatingsystem -%> that doesn’t work still it’s the evaluation of host.operatingsystem that creates the error when I click create host.