summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--cloudinit/config/cc_ssh_import_id.py3
-rw-r--r--cloudinit/stages.py36
-rw-r--r--doc/examples/cloud-config.txt10
4 files changed, 39 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index fcc9e7cb..1e08491b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -24,6 +24,8 @@
- initial freebsd support [Harm Weites]
- fix in is_ipv4 to accept IP addresses with a '0' in them.
- Azure: fix issue when stale data in /var/lib/waagent (LP: #1269626)
+ - skip config_modules that declare themselves only verified on a set of
+ distros. Add them to 'unverified_modules' list to run anyway.
0.7.4:
- fix issue mounting 'ephemeral0' if ephemeral0 was an alias for a
partitioned block device with target filesystem on ephemeral0.1.
diff --git a/cloudinit/config/cc_ssh_import_id.py b/cloudinit/config/cc_ssh_import_id.py
index 50d96e15..76c1663d 100644
--- a/cloudinit/config/cc_ssh_import_id.py
+++ b/cloudinit/config/cc_ssh_import_id.py
@@ -26,9 +26,8 @@ from cloudinit import distros as ds
from cloudinit import util
import pwd
-# The ssh-import-id only seems to exist on ubuntu (for now)
# https://launchpad.net/ssh-import-id
-distros = ['ubuntu']
+distros = ['ubuntu', 'debian']
def handle(_name, cfg, cloud, log, args):
diff --git a/cloudinit/stages.py b/cloudinit/stages.py
index 593b72a2..7acd3355 100644
--- a/cloudinit/stages.py
+++ b/cloudinit/stages.py
@@ -632,7 +632,6 @@ class Modules(object):
return mostly_mods
def _run_modules(self, mostly_mods):
- d_name = self.init.distro.name
cc = self.init.cloudify()
# Return which ones ran
# and which ones failed + the exception of why it failed
@@ -646,15 +645,6 @@ class Modules(object):
if not freq in FREQUENCIES:
freq = PER_INSTANCE
- worked_distros = set(mod.distros)
- worked_distros.update(
- distros.Distro.expand_osfamily(mod.osfamilies))
-
- if (worked_distros and d_name not in worked_distros):
- LOG.warn(("Module %s is verified on %s distros"
- " but not on %s distro. It may or may not work"
- " correctly."), name, list(worked_distros),
- d_name)
# Use the configs logger and not our own
# TODO(harlowja): possibly check the module
# for having a LOG attr and just give it back
@@ -686,6 +676,32 @@ class Modules(object):
def run_section(self, section_name):
raw_mods = self._read_modules(section_name)
mostly_mods = self._fixup_modules(raw_mods)
+ d_name = self.init.distro.name
+
+ skipped = []
+ forced = []
+ overridden = self.cfg.get('unverified_modules', [])
+ for (mod, name, _freq, _args) in mostly_mods:
+ worked_distros = set(mod.distros)
+ worked_distros.update(
+ distros.Distro.expand_osfamily(mod.osfamilies))
+
+ # module does not declare 'distros' or lists this distro
+ if not worked_distros or d_name in worked_distros:
+ continue
+
+ if name in overridden:
+ forced.append(name)
+ else:
+ skipped.append(name)
+
+ if skipped:
+ LOG.info("Skipping modules %s because they are not verified "
+ "on distro '%s'. To run anyway, add them to "
+ "'unverified_modules' in config.", skipped, d_name)
+ if forced:
+ LOG.info("running unverified_modules: %s", forced)
+
return self._run_modules(mostly_mods)
diff --git a/doc/examples/cloud-config.txt b/doc/examples/cloud-config.txt
index 61fa6065..ed4eb7fc 100644
--- a/doc/examples/cloud-config.txt
+++ b/doc/examples/cloud-config.txt
@@ -319,6 +319,16 @@ cloud_config_modules:
- runcmd
- byobu
+# unverified_modules: []
+# if a config module declares a set of distros as supported then it will be
+# skipped if running on a different distro. to override this sanity check,
+# provide a list of modules that should be run anyway in 'unverified_modules'.
+# The default is an empty list (ie, trust modules).
+#
+# Example:
+# unverified_modules: ['apt-update-upgrade']
+# default: []
+
# ssh_import_id: [ user1, user2 ]
# ssh_import_id will feed the list in that variable to
# ssh-import-id, so that public keys stored in launchpad