1
0
mirror of https://github.com/gryf/boxpy.git synced 2025-12-19 05:30:18 +01:00

Added cleanup for interrupted cloud-init

This commit is contained in:
2021-05-05 20:24:07 +02:00
parent da1ae93fa2
commit 91f0019c78

5
box.py
View File

@@ -589,6 +589,9 @@ class IsoImage:
if not self.ssh_key_path.endswith('.pub'):
self.ssh_key_path += '.pub'
if not os.path.exists(self.ssh_key_path):
self.ssh_key_path = os.path.join(os.path
.expanduser(self.ssh_key_path))
if not os.path.exists(self.ssh_key_path):
self.ssh_key_path = os.path.join(os.path.expanduser("~/.ssh"),
self.ssh_key_path)
@@ -669,6 +672,8 @@ def vmcreate(args):
except KeyboardInterrupt:
print('\nIterrupted, cleaning up.')
VBoxManage(args.name).destroy()
iso.cleanup()
image.cleanup()
return 1
# dettach ISO image