mirror of
https://github.com/gryf/boxpy.git
synced 2025-12-19 13:37:58 +01:00
Add missing media closing
This commit is contained in:
7
box.py
7
box.py
@@ -201,8 +201,10 @@ class VBoxManage:
|
|||||||
raise BoxVBoxFailure('Cannot convert image to VDI.')
|
raise BoxVBoxFailure('Cannot convert image to VDI.')
|
||||||
os.unlink(src)
|
os.unlink(src)
|
||||||
|
|
||||||
def closemedium(self, mediumpath):
|
def closemedium(self, type_, mediumpath):
|
||||||
subprocess.call(['vboxmanage', 'closemedium', 'dvd', mediumpath])
|
if subprocess.call(['vboxmanage', 'closemedium', type_,
|
||||||
|
mediumpath]) != 0:
|
||||||
|
raise BoxVBoxFailure(f'Failed close medium {mediumpath}.')
|
||||||
|
|
||||||
def create_controller(self, name, type_):
|
def create_controller(self, name, type_):
|
||||||
if subprocess.call(['vboxmanage', 'storagectl', self.name_or_uuid,
|
if subprocess.call(['vboxmanage', 'storagectl', self.name_or_uuid,
|
||||||
@@ -398,6 +400,7 @@ def vmcreate(args):
|
|||||||
break
|
break
|
||||||
# dettach ISO image
|
# dettach ISO image
|
||||||
vbox.storageattach('IDE', 1, 'dvddrive', 'none')
|
vbox.storageattach('IDE', 1, 'dvddrive', 'none')
|
||||||
|
vbox.closemedium('dvd', path_to_iso)
|
||||||
iso.cleanup()
|
iso.cleanup()
|
||||||
image.cleanup()
|
image.cleanup()
|
||||||
vbox.poweron()
|
vbox.poweron()
|
||||||
|
|||||||
Reference in New Issue
Block a user