% characters in cloud-init configs render as 0 in instance
-
Anyone else using jinja template directives for provisioning new VMs?
Im running 8.2 XO commit a5967 and Master ba375.
I started noticing that my cloud-init configs are behaving a bit different now when I provision new VM's.
In the hostname variable for example, I have used {name}% as the hostname variable to pass the VM name meta data to cloud-init.
Example:#cloud-config fqdn: {name}%
Now the hostname will render with a 0 on the end, ie: somehost.example.com0 rather than the vm name of somehost.example.com.
So I removed the % from the {name}% directive and now it renders the hostname correct.
However, any cloud-init configs with jinja templating in them, (using the same % character) no longer work, since the jinja variables show up in the user-data file presented to cloud-init in the nocloud datasource as {0 if distro == ... 0} when it used to pass the jinja coding to cloud-init.
As used in the cloud-init config in XOA:
{% if distro == 'rocky' or distro == 'centos' or distro == 'ol' or distro == 'almalinux' or distro == 'fedora' or distro == 'redhat' %}
renders as in user-data file as:
{0 if distro == 'rocky' or distro == 'centos' or distro == 'ol' or distro == 'almalinux' or distro == 'fedora' or distro == 'redhat' 0}
So this hoses jinja from rendering the variables.
Anyone else notice a change in how metadata is being presented to cloud-init? Possible bug, or some change I didn't notice until now? Not a deal breaker for me, since I have other configs that work fine, just odd how it changed. If I find a solution to this, I will share here.
TIA!