mirror of
https://github.com/gryf/boxpy.git
synced 2026-02-12 20:05:55 +01:00
Guard against interruption during invalid cloud config.
This commit is contained in:
6
box.py
6
box.py
@@ -578,6 +578,7 @@ def vmcreate(args):
|
|||||||
|
|
||||||
# than, let's try to see if boostraping process has finished
|
# than, let's try to see if boostraping process has finished
|
||||||
print('Waiting for cloud init to finish ', end='')
|
print('Waiting for cloud init to finish ', end='')
|
||||||
|
try:
|
||||||
while True:
|
while True:
|
||||||
if vbox.vm_info['uuid'] in vbox.get_running_vms():
|
if vbox.vm_info['uuid'] in vbox.get_running_vms():
|
||||||
print('.', end='')
|
print('.', end='')
|
||||||
@@ -586,6 +587,11 @@ def vmcreate(args):
|
|||||||
else:
|
else:
|
||||||
print(' done.')
|
print(' done.')
|
||||||
break
|
break
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print('\nIterrupted, cleaning up.')
|
||||||
|
VBoxManage(args.name).destroy()
|
||||||
|
return 1
|
||||||
|
|
||||||
# dettach ISO image
|
# dettach ISO image
|
||||||
vbox.storageattach('IDE', 1, 'dvddrive', 'none')
|
vbox.storageattach('IDE', 1, 'dvddrive', 'none')
|
||||||
vbox.closemedium('dvd', path_to_iso)
|
vbox.closemedium('dvd', path_to_iso)
|
||||||
|
|||||||
Reference in New Issue
Block a user