Use factory to get the image classes
This commit is contained in:
parent
c922ae64a9
commit
5878db3e81
@ -367,12 +367,8 @@ class Lorax(BaseLoraxClass):
|
||||
self.variant, self.basearch)
|
||||
|
||||
# get the image class
|
||||
if self.basearch == "ppc":
|
||||
imgclass = images.PPC
|
||||
elif self.basearch in ("i386", "x86_64"):
|
||||
imgclass = images.X86
|
||||
else:
|
||||
raise Exception("not supported arch '{0}'".format(self.basearch))
|
||||
factory = images.Factory()
|
||||
imgclass = factory.get_class(self.basearch)
|
||||
|
||||
i = imgclass(kernellist=self.outputtree.kernels,
|
||||
installtree=self.installtree,
|
||||
|
@ -667,3 +667,21 @@ class S390(object):
|
||||
|
||||
def create_boot(self, efiboot=None):
|
||||
pass
|
||||
|
||||
|
||||
class Factory(object):
|
||||
|
||||
DISPATCH_MAP = {"ppc": PPC,
|
||||
"i386": X86,
|
||||
"x86_64": X86,
|
||||
"s390": S390,
|
||||
"s390x": S390}
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def get_class(self, arch):
|
||||
if arch in self.DISPATCH_MAP:
|
||||
return self.DISPATCH_MAP[arch]
|
||||
else:
|
||||
raise Exception("no support for {0}".format(arch))
|
||||
|
Loading…
Reference in New Issue
Block a user