drop 'is_excluded'.
for now, this the mechanism just doesn't seem right. I think i'd rather have the module declare supported distros than have distros declare [un]supported modules.
This commit is contained in:
parent
eefdcc1897
commit
5b0ae99101
@ -51,8 +51,6 @@ EXPORT_GPG_KEYID = """
|
||||
|
||||
|
||||
def handle(name, cfg, cloud, log, _args):
|
||||
if cloud.distro.is_excluded(name):
|
||||
return
|
||||
release = get_release()
|
||||
mirrors = find_apt_mirror_info(cloud, cfg)
|
||||
if not mirrors or "primary" not in mirrors:
|
||||
|
@ -35,8 +35,6 @@ APT_PIPE_TPL = ("//Written by cloud-init per 'apt_pipelining'\n"
|
||||
|
||||
|
||||
def handle(_name, cfg, _cloud, log, _args):
|
||||
if _cloud.distro.is_excluded(_name):
|
||||
return
|
||||
apt_pipe_value = util.get_cfg_option_str(cfg, "apt_pipelining", False)
|
||||
apt_pipe_value_s = str(apt_pipe_value).lower().strip()
|
||||
|
||||
|
@ -29,8 +29,6 @@ def handle(_name, cfg, _cloud, log, _args):
|
||||
idevs = None
|
||||
idevs_empty = None
|
||||
|
||||
if _cloud.distro.is_excluded(_name):
|
||||
return
|
||||
if "grub-dpkg" in cfg:
|
||||
idevs = util.get_cfg_option_str(cfg["grub-dpkg"],
|
||||
"grub-pc/install_devices", None)
|
||||
|
@ -56,20 +56,12 @@ 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.exclude_modules:
|
||||
distro = getattr(self, name, None) or getattr(self, 'osfamily')
|
||||
LOG.debug(("Skipping module named %s, distro %s excluded"), name,
|
||||
distro)
|
||||
return True
|
||||
|
||||
@abc.abstractmethod
|
||||
def install_packages(self, pkglist):
|
||||
raise NotImplementedError()
|
||||
|
@ -36,12 +36,6 @@ class Distro(distros.Distro):
|
||||
tz_local_fn = "/etc/localtime"
|
||||
resolve_conf_fn = "/etc/resolv.conf"
|
||||
init_cmd = ['systemctl'] # init scripts
|
||||
exclude_modules = [
|
||||
'grub-dpkg',
|
||||
'apt-configure',
|
||||
'apt-pipelining',
|
||||
'yum-add-repo',
|
||||
]
|
||||
|
||||
def __init__(self, name, cfg, paths):
|
||||
distros.Distro.__init__(self, name, cfg, paths)
|
||||
|
@ -34,11 +34,6 @@ class Distro(distros.Distro):
|
||||
tz_conf_fn = "/etc/timezone"
|
||||
tz_local_fn = "/etc/localtime"
|
||||
init_cmd = [''] # init scripts
|
||||
exclude_modules = [
|
||||
'grub-dpkg',
|
||||
'apt-configure',
|
||||
'apt-pipelining',
|
||||
]
|
||||
|
||||
def __init__(self, name, cfg, paths):
|
||||
distros.Distro.__init__(self, name, cfg, paths)
|
||||
|
@ -1,15 +0,0 @@
|
||||
from cloudinit.distros import gentoo
|
||||
import unittest
|
||||
|
||||
|
||||
class TestIsExcluded(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.distro = gentoo.Distro('gentoo', {}, None)
|
||||
self.distro.exclude_modules = ['test-module']
|
||||
|
||||
def test_is_excluded_success(self):
|
||||
self.assertEqual(self.distro.is_excluded('test-module'), True)
|
||||
|
||||
def test_is_excluded_fail(self):
|
||||
self.assertEqual(self.distro.is_excluded('missing'), None)
|
Loading…
x
Reference in New Issue
Block a user