cloudinit: Fix disabling cloud-init on first boot

`sudo` throws errors and is not even required to write the `disable`
file. Also add a message to the file that it was created by us

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2022-03-01 14:27:31 -05:00
parent 767f856017
commit 78e24fc986
1 changed files with 2 additions and 1 deletions

View File

@ -95,7 +95,8 @@ def _create_userdata_content(cloudinit_data):
if cloudinit_data.disable:
content += "runcmd:\n"
content += "- [ sudo, touch, /etc/cloud/cloud-init.disabled ]\n"
content += ('- echo "Disabled by virt-install" > '
"/etc/cloud/cloud-init.disabled\n")
clean_content = re.sub(r"root:(.*)", 'root:[SCRUBBLED]', content)
if "VIRTINST_TEST_SUITE_PRINT_CLOUDINIT" in os.environ: