Skip to content

Instantly share code, notes, and snippets.

@harlowja
Created July 21, 2016 18:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harlowja/e2333dd3ed219b53ef44671185177c3e to your computer and use it in GitHub Desktop.
Save harlowja/e2333dd3ed219b53ef44671185177c3e to your computer and use it in GitHub Desktop.
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment