diff --git a/bareon/drivers/base.py b/bareon/drivers/base.py index 7fb7f10..9586e7c 100644 --- a/bareon/drivers/base.py +++ b/bareon/drivers/base.py @@ -29,22 +29,38 @@ class BaseDataDriver(object): def __init__(self, data): self.data = copy.deepcopy(data) + +@six.add_metaclass(abc.ABCMeta) +class PartitioningDataDriverMixin(object): + @abc.abstractproperty def partition_scheme(self): """Retruns instance of PartionScheme object""" + +@six.add_metaclass(abc.ABCMeta) +class ProvisioningDataDriverMixin(object): + @abc.abstractproperty def image_scheme(self): """Returns instance of ImageScheme object""" - @abc.abstractproperty - def grub(self): - """Returns instance of Grub object""" - @abc.abstractproperty def operating_system(self): """Returns instance of OperatingSystem object""" + +@six.add_metaclass(abc.ABCMeta) +class ConfigDriveDataDriverMixin(object): + @abc.abstractproperty def configdrive_scheme(self): """Returns instance of ConfigDriveScheme object""" + + +@six.add_metaclass(abc.ABCMeta) +class GrubBootloaderDataDriverMixin(object): + + @abc.abstractproperty + def grub(self): + """Returns instance of Grub object""" diff --git a/bareon/drivers/nailgun.py b/bareon/drivers/nailgun.py index 462a24f..1d3b152 100644 --- a/bareon/drivers/nailgun.py +++ b/bareon/drivers/nailgun.py @@ -24,6 +24,10 @@ from six.moves.urllib.parse import urlsplit import yaml from bareon.drivers.base import BaseDataDriver +from bareon.drivers.base import ConfigDriveDataDriverMixin +from bareon.drivers.base import GrubBootloaderDataDriverMixin +from bareon.drivers.base import PartitioningDataDriverMixin +from bareon.drivers.base import ProvisioningDataDriverMixin from bareon.drivers import ks_spaces_validator from bareon import errors from bareon import objects @@ -71,7 +75,11 @@ def match_device(hu_disk, ks_disk): return False -class Nailgun(BaseDataDriver): +class Nailgun(BaseDataDriver, + PartitioningDataDriverMixin, + ProvisioningDataDriverMixin, + ConfigDriveDataDriverMixin, + GrubBootloaderDataDriverMixin): """Driver for parsing regular volumes metadata from Nailgun.""" def __init__(self, data): @@ -624,7 +632,10 @@ class Ironic(Nailgun): return super(Ironic, self).parse_partition_scheme() -class NailgunBuildImage(BaseDataDriver): +class NailgunBuildImage(BaseDataDriver, + ProvisioningDataDriverMixin, + ConfigDriveDataDriverMixin, + GrubBootloaderDataDriverMixin): # TODO(kozhukalov): # This list of packages is used by default only if another