mirror of
https://github.com/gryf/boxpy.git
synced 2025-12-19 13:37:58 +01:00
Added cleanup for interrupted cloud-init
This commit is contained in:
5
box.py
5
box.py
@@ -589,6 +589,9 @@ class IsoImage:
|
|||||||
|
|
||||||
if not self.ssh_key_path.endswith('.pub'):
|
if not self.ssh_key_path.endswith('.pub'):
|
||||||
self.ssh_key_path += '.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):
|
if not os.path.exists(self.ssh_key_path):
|
||||||
self.ssh_key_path = os.path.join(os.path.expanduser("~/.ssh"),
|
self.ssh_key_path = os.path.join(os.path.expanduser("~/.ssh"),
|
||||||
self.ssh_key_path)
|
self.ssh_key_path)
|
||||||
@@ -669,6 +672,8 @@ def vmcreate(args):
|
|||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print('\nIterrupted, cleaning up.')
|
print('\nIterrupted, cleaning up.')
|
||||||
VBoxManage(args.name).destroy()
|
VBoxManage(args.name).destroy()
|
||||||
|
iso.cleanup()
|
||||||
|
image.cleanup()
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
# dettach ISO image
|
# dettach ISO image
|
||||||
|
|||||||
Reference in New Issue
Block a user