1
0
mirror of https://github.com/gryf/boxpy.git synced 2025-12-18 21:10:17 +01:00

Adding extra data 'creator'.

This field would help to distinguish if VM has been created by boxpy, or
manually.
This commit is contained in:
2021-06-27 19:32:16 +02:00
parent ac47f126c0
commit 21dc3ec2ce

8
box.py
View File

@@ -330,13 +330,14 @@ class FakeLogger:
class Config:
ATTRS = ('cpus', 'config', 'disk_size', 'distro', 'hostname', 'key',
'memory', 'name', 'port', 'version')
ATTRS = ('cpus', 'config', 'creator', 'disk_size', 'distro', 'hostname',
'key', 'memory', 'name', 'port', 'version')
def __init__(self, args, vbox=None):
self.advanced = None
self.distro = None
self.cpus = None
self.creator = None
self.disk_size = None
self.hostname = None
self.key = None
@@ -1032,6 +1033,9 @@ def vmcreate(args, conf=None):
if not vbox.setextradata('user_data', conf.user_data):
return 6
if not vbox.setextradata('creator', 'boxpy'):
return 13
image = get_image_object(vbox, conf.version, image=conf.distro)
path_to_disk = image.convert_to_vdi(conf.name + '.vdi', conf.disk_size)