← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~rjschwei/cloud-init:emptyStageOK into cloud-init:master

 

Robert Schweikert has proposed merging ~rjschwei/cloud-init:emptyStageOK into cloud-init:master.

Requested reviews:
  cloud-init commiters (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~rjschwei/cloud-init/+git/cloud-init/+merge/345377

The user may create a config file that has an empty stage such as

cloud_init_modules:

cloud_config_modules:
 - mounts

if a stage is empty a traceback is generated. With this change an informational message logged and continues processing
-- 
Your team cloud-init commiters is requested to review the proposed merge of ~rjschwei/cloud-init:emptyStageOK into cloud-init:master.
diff --git a/cloudinit/stages.py b/cloudinit/stages.py
index 3998cf6..d9a560e 100644
--- a/cloudinit/stages.py
+++ b/cloudinit/stages.py
@@ -698,6 +698,10 @@ class Modules(object):
         if name not in self.cfg:
             return module_list
         cfg_mods = self.cfg[name]
+        if not cfg_mods:
+            LOG.info("No configuration modules defined for stage: "
+                     "%s SKipping stage" % name)
+            return module_list
         # Create 'module_list', an array of hashes
         # Where hash['mod'] = module name
         #       hash['freq'] = frequency

References