diff options
-rw-r--r-- | cloudinit/distros/__init__.py | 4 | ||||
-rw-r--r-- | cloudinit/distros/ubuntu.py | 8 | ||||
-rw-r--r-- | cloudinit/stages.py | 12 |
3 files changed, 15 insertions, 9 deletions
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py index e85e702e..0ee7f06b 100644 --- a/cloudinit/distros/__init__.py +++ b/cloudinit/distros/__init__.py @@ -42,8 +42,8 @@ class Distro(object): __metaclass__ = abc.ABCMeta - def __init__(self, name, cfg, runner): - self._runner = runner + def __init__(self, name, cfg, paths): + self._paths = paths self._cfg = cfg self.name = name diff --git a/cloudinit/distros/ubuntu.py b/cloudinit/distros/ubuntu.py index ad12400a..9b743b55 100644 --- a/cloudinit/distros/ubuntu.py +++ b/cloudinit/distros/ubuntu.py @@ -23,6 +23,7 @@ import os from cloudinit import distros +from cloudinit import helpers from cloudinit import log as logging from cloudinit import util @@ -33,6 +34,13 @@ LOG = logging.getLogger(__name__) class Distro(distros.Distro): + def __init__(self, name, cfg, paths): + distros.Distro.__init__(self, name, cfg, paths) + # This will be used to restrict certain + # calls from repeatly happening (when they + # should only happen say once per instance...) + self._runner = helpers.Runners(paths) + def install_packages(self, pkglist): self._update_package_sources() self._apt_get('install', pkglist) diff --git a/cloudinit/stages.py b/cloudinit/stages.py index 9d8ff2bb..8fa9d6d3 100644 --- a/cloudinit/stages.py +++ b/cloudinit/stages.py @@ -77,13 +77,11 @@ class Init(object): def distro(self): if not self._distro: # Try to find the right class to use - d_cfg = self._extract_cfg('system') - distro_name = d_cfg.pop('distro', 'ubuntu') - distro_cls = distros.fetch(distro_name) - LOG.debug("Using distro class %s", distro_cls) - distro = distro_cls(distro_name, d_cfg, - helpers.Runners(self.paths)) - self._distro = distro + scfg = self._extract_cfg('system') + name = scfg.pop('distro', 'ubuntu') + cls = distros.fetch(name) + LOG.debug("Using distro class %s", cls) + self._distro = cls(name, scfg, self.paths) return self._distro @property |