summaryrefslogtreecommitdiff
path: root/cloudinit/stages.py
diff options
context:
space:
mode:
authorRobert Schweikert <rjschwei@suse.com>2018-06-15 13:41:21 -0600
committerChad Smith <chad.smith@canonical.com>2018-06-15 13:41:21 -0600
commitfef2616b9876d3d354b0de1a8e753361e52e77b0 (patch)
tree80aa5f12d77a5ea0b03718343fcfefac6c0f1690 /cloudinit/stages.py
parentfaa6f07e9de4058083a5f69ed508b6e24bd53b23 (diff)
downloadcloud-init-git-fef2616b9876d3d354b0de1a8e753361e52e77b0.tar.gz
stages: fix tracebacks if a module stage is undefined or empty
In /etc/cloud/cloud.cfg, users and imagees can configure which modules run during a specific cloud-init stage by modifying one of the following lists: cloud_init_modules, cloud_init_modules, cloud_init_final_modules. If any of the configured module lists are absent or empty, cloud-init will emit the same message it already does for existing lists that only contain modules which are not unsupported on that platform: No 'config' modules to run under section 'cloud_config_modules' LP: #1770462
Diffstat (limited to 'cloudinit/stages.py')
-rw-r--r--cloudinit/stages.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/cloudinit/stages.py b/cloudinit/stages.py
index 3998cf68..286607bf 100644
--- a/cloudinit/stages.py
+++ b/cloudinit/stages.py
@@ -697,7 +697,9 @@ class Modules(object):
module_list = []
if name not in self.cfg:
return module_list
- cfg_mods = self.cfg[name]
+ cfg_mods = self.cfg.get(name)
+ if not cfg_mods:
+ return module_list
# Create 'module_list', an array of hashes
# Where hash['mod'] = module name
# hash['freq'] = frequency