Further work on provisioner

This commit is contained in:
2019-12-08 23:05:17 -05:00
parent 3471f4e57a
commit 2dd6247d7b
6 changed files with 397 additions and 16 deletions

View File

@ -122,6 +122,11 @@ def install(**kwargs):
cpass=cpass
))
# Write the hostname
hostname_file = "{}/etc/hostname".format(temporary_directory)
with open(hostname_file, 'w') as fh:
fh.write("{}".format(vm_name))
# Write the GRUB configuration
grubcfg_file = "{}/etc/default/grub".format(temporary_directory)
with open(grubcfg_file, 'w') as fh:
@ -149,6 +154,9 @@ GRUB_DISABLE_LINUX_UUID=false
os.system(
"update-grub"
)
os.system(
"echo root:test123 | chpasswd"
)
# Restore our original root
os.fchdir(real_root)
os.chroot(".")
@ -163,4 +171,8 @@ GRUB_DISABLE_LINUX_UUID=false
)
)
# Clean up file handles so paths can be unmounted
del fake_root
del real_root
# Everything else is done via cloud-init