From 309457a96a84132d2e570bf902c464b2a1aa9d0b Mon Sep 17 00:00:00 2001 From: "Nate House nathan.house@rackspace.com" <> Date: Mon, 27 Jan 2014 12:22:21 -0600 Subject: Adds distro module exclude support --- cloudinit/distros/__init__.py | 8 ++++++++ cloudinit/distros/gentoo.py | 1 + 2 files changed, 9 insertions(+) (limited to 'cloudinit/distros') diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py index 9c9ac384..a6d1e6c6 100644 --- a/cloudinit/distros/__init__.py +++ b/cloudinit/distros/__init__.py @@ -54,12 +54,20 @@ class Distro(object): hostname_conf_fn = "/etc/hostname" tz_zone_dir = "/usr/share/zoneinfo" init_cmd = ['service'] # systemctl, service etc + exclude_modules = [] def __init__(self, name, cfg, paths): self._paths = paths self._cfg = cfg self.name = name + def is_excluded(self, name): + if name in self.excluded_modules: + distro = getattr(self, name, None) or getattr(self, 'osfamily') + LOG.debug(("Skipping module named %s, distro excluded"), name, + distro) + return True + @abc.abstractmethod def install_packages(self, pkglist): raise NotImplementedError() diff --git a/cloudinit/distros/gentoo.py b/cloudinit/distros/gentoo.py index 565c68ed..fbd96b36 100644 --- a/cloudinit/distros/gentoo.py +++ b/cloudinit/distros/gentoo.py @@ -38,6 +38,7 @@ class Distro(distros.Distro): tz_conf_fn = "/etc/timezone" tz_local_fn = "/etc/localtime" init_cmd = [''] + exclude_modules = ['grub_dpkg', 'apt_configure'] def __init__(self, name, cfg, paths): distros.Distro.__init__(self, name, cfg, paths) -- cgit v1.2.3