mirror of
https://github.com/gryf/boxpy.git
synced 2025-12-19 21:47:59 +01:00
Move setting defaults to Config class.
This commit is contained in:
9
box.py
9
box.py
@@ -278,6 +278,10 @@ class Config:
|
|||||||
continue
|
continue
|
||||||
setattr(self, attr, str(val))
|
setattr(self, attr, str(val))
|
||||||
|
|
||||||
|
# set distribution and version if not specified by user
|
||||||
|
if not self.distro:
|
||||||
|
self.distro = 'ubuntu'
|
||||||
|
|
||||||
if not self.version and self.distro:
|
if not self.version and self.distro:
|
||||||
self.version = DISTROS[self.distro]['default_version']
|
self.version = DISTROS[self.distro]['default_version']
|
||||||
|
|
||||||
@@ -850,9 +854,6 @@ class IsoImage:
|
|||||||
|
|
||||||
def vmcreate(args, conf=None):
|
def vmcreate(args, conf=None):
|
||||||
|
|
||||||
if not args.distro:
|
|
||||||
args.distro = 'ubuntu'
|
|
||||||
|
|
||||||
if not conf:
|
if not conf:
|
||||||
conf = Config(args)
|
conf = Config(args)
|
||||||
|
|
||||||
@@ -876,7 +877,7 @@ def vmcreate(args, conf=None):
|
|||||||
if conf.user_data:
|
if conf.user_data:
|
||||||
vbox.setextradata('user_data', conf.user_data)
|
vbox.setextradata('user_data', conf.user_data)
|
||||||
|
|
||||||
image = get_image(vbox, conf.version, image=args.distro)
|
image = get_image(vbox, conf.version, image=conf.distro)
|
||||||
path_to_disk = image.convert_to_vdi(conf.name + '.vdi', conf.disk_size)
|
path_to_disk = image.convert_to_vdi(conf.name + '.vdi', conf.disk_size)
|
||||||
|
|
||||||
iso = IsoImage(conf)
|
iso = IsoImage(conf)
|
||||||
|
|||||||
Reference in New Issue
Block a user