Hostname changes after every reboot with OpenNebula
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Expired
|
Medium
|
Unassigned |
Bug Description
When using the OpenNebula datasource (Ubuntu 16.04.4, cloud-init 18.2-4-
I took some time to review the code, and I believe it's happening because HOSTNAME is a bash environment variable and also in context.sh that is sourced in. When I applied the attached patch to unset HOSTNAME prior to sourcing context.sh, the correct hostname stays persistent across reboots. I'm not sure though if this is a "proper" fix for the issue, but it's working for us.
Example:
root@cjm1604:~# cat /run/cloud-
{
"availability
"cloud-name": "opennebula",
"instance-id": "iid-dsopennebula",
"local-hostname": "cjm1604",
"region": null
}
root@cjm1604:~# reboot
root@ip-
{
"availability
"cloud-name": "opennebula",
"instance-id": "iid-dsopennebula",
"local-hostname": "ip-10-
"region": null
}
root@ip-
root@cjm1604:~# cat /run/cloud-
{
"availability
"cloud-name": "opennebula",
"instance-id": "iid-dsopennebula",
"local-hostname": "cjm1604",
"region": null
}
root@cjm1604:~# reboot
Let me know if you require any additional information.
Cheers,
Corey Melanson
Hi Corey,
It looks like you have correctly identified this bug and the right fix. bash was setting the HOSTNAME variable which was throwing a wrench into assumptions of the parse_shell_config.
Could you follow http:// cloudinit. readthedocs. io/en/latest/ topics/ hacking. html and submit a merge proposal?
Please let me know if you have any questions. Feel free to ping in FreeNode IRC (smoser) or here.