~harlowja/cloud-init/cloud-init-really-skip-baddies

« back to all changes in this revision

Viewing changes to cloudinit/stages.py

  • Committer: Joshua Harlow
  • Date: 2016-07-21 18:15:53 UTC
  • Revision ID: harlowja@gmail.com-20160721181553-n3m237ncdq90hmx3
Actually remove skipped modules

Instead of just logging about distro modules not known
to work on the host distro and then going ahead and still
running them this changes it so they are actually fixed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
808
808
    def run_section(self, section_name):
809
809
        raw_mods = self._read_modules(section_name)
810
810
        mostly_mods = self._fixup_modules(raw_mods)
811
 
        d_name = self.init.distro.name
 
811
        distro_name = self.init.distro.name
812
812
 
813
813
        skipped = []
814
814
        forced = []
819
819
                distros.Distro.expand_osfamily(mod.osfamilies))
820
820
 
821
821
            # module does not declare 'distros' or lists this distro
822
 
            if not worked_distros or d_name in worked_distros:
 
822
            if not worked_distros or distro_name in worked_distros:
823
823
                continue
824
824
 
825
825
            if name in overridden:
827
827
            else:
828
828
                skipped.append(name)
829
829
 
 
830
        cleaned_mostly_mods = []
 
831
        for (mod, name, freq, args) in mostly_mods:
 
832
            if name in skipped:
 
833
                continue
 
834
            cleaned_mostly_mods.append((mod, name, freq, args))
 
835
 
830
836
        if skipped:
831
837
            LOG.info("Skipping modules %s because they are not verified "
832
838
                     "on distro '%s'.  To run anyway, add them to "
833
 
                     "'unverified_modules' in config.", skipped, d_name)
 
839
                     "'unverified_modules' in config.", skipped, distro_name)
834
840
        if forced:
835
 
            LOG.info("running unverified_modules: %s", forced)
 
841
            LOG.info("Running unverified modules: %s", forced)
836
842
 
837
 
        return self._run_modules(mostly_mods)
 
843
        return self._run_modules(cleaned_mostly_mods)
838
844
 
839
845
 
840
846
def fetch_base_config():