Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/cmd-artifact-disk
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,20 @@ import cosalib.vmware as VmwareOVA


def get_builder(imgtype, build_root, build="latest", force=False, schema=None):
args = [build_root, build]
kargs = {
"build": build,
"buildroot": build_root,
"force": force,
"schema": schema,
"variant": imgtype
}

if imgtype in QVariants.VARIANTS:
log.info(f"Target '{imgtype.upper()}' is a Qemu Variant image")
return QVariants.QemuVariantImage(*args, **kargs)
return QVariants.QemuVariantImage(**kargs)

if imgtype in VmwareOVA.VARIANTS:
return VmwareOVA.VmwareOVA(*args, **kargs)
return VmwareOVA.VmwareOVA(**kargs)

raise Exception(f"{imgtype} is not supported by this command")

Expand Down
4 changes: 1 addition & 3 deletions src/cosalib/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,11 @@ class _Build:
- _build_artifacts(*args, **kwargs)
"""

def __init__(self, *args, **kwargs):
def __init__(self, **kwargs):
"""
init loads the builds.json which lists the builds, loads the relevant
meta-data from JSON and finally, locates the build artifacts.

:param args: All non-keyword arguments
:type args: list
:param kwargs: All keyword arguments
:type kwargs: dict
:raises: BuildError
Expand Down
8 changes: 4 additions & 4 deletions src/cosalib/qemuvariants.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,16 @@ def get_qemu_variant(variant, parser, kwargs={}):
"""
log.debug(f"returning QemuVariantImage for {variant}")
return QemuVariantImage(
parser.buildroot,
parser.build,
buildroot=parser.buildroot,
build=parser.build,
schema=parser.schema,
variant=variant,
force=parser.force,
**kwargs)


class QemuVariantImage(_Build):
def __init__(self, *args, **kwargs):
def __init__(self, **kwargs):
"""
This takes all the regular _BuildClass arguments. In kwargs, the
additional arguments are used:
Expand Down Expand Up @@ -164,7 +164,7 @@ def __init__(self, *args, **kwargs):
self.platform_image_name = kwargs.get(
"platform_image_name", self.platform)

_Build.__init__(self, *args, **kwargs)
_Build.__init__(self, **kwargs)

@property
def image_qemu(self):
Expand Down
4 changes: 2 additions & 2 deletions src/cosalib/vmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ class VmwareOVA(QemuVariantImage):
https://www.dmtf.org/sites/default/files/standards/documents/DSP0243_1.1.0.pdf
"""

def __init__(self, *args, **kwargs):
def __init__(self, **kwargs):
variant = kwargs.pop("variant", "vmware")
kwargs.update(VARIANTS.get(variant, {}))
QemuVariantImage.__init__(self, *args, **kwargs)
QemuVariantImage.__init__(self, **kwargs)
# Set the QemuVariant mutate_callback so that OVA is called.
self.mutate_callback = self.write_ova
# Ensure that coreos.ovf is included in the tar
Expand Down