diff options
author | Wesley Wiedenmeier <wesley.wiedenmeier@gmail.com> | 2016-12-20 10:12:24 -0600 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2016-12-21 10:12:27 -0500 |
commit | 0b0f254a6935a1b1fff128fa177152dd519e1a3d (patch) | |
tree | 967ff205e822f6a8fac8c65ae82bcfb6d21d09c2 /cloudinit/stages.py | |
parent | 93cf879ddee1e492d66b02a41965323f5a165784 (diff) | |
download | vyos-cloud-init-0b0f254a6935a1b1fff128fa177152dd519e1a3d.tar.gz vyos-cloud-init-0b0f254a6935a1b1fff128fa177152dd519e1a3d.zip |
Fix config order of precedence, putting kernel command line over system.
The correct order of precedence when reading the base config:
builtin config
system config
kernel command line provided config.
This reverts commit 63501f44, which actually broke the behavior it
reported to fix. It also adds some unit tests to ensure this behavior
is not broken again.
LP: #1582323
Diffstat (limited to 'cloudinit/stages.py')
-rw-r--r-- | cloudinit/stages.py | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/cloudinit/stages.py b/cloudinit/stages.py index 86a13785..ca3f02fe 100644 --- a/cloudinit/stages.py +++ b/cloudinit/stages.py @@ -845,23 +845,15 @@ class Modules(object): def fetch_base_config(): - base_cfgs = [] - default_cfg = util.get_builtin_cfg() - - # Anything in your conf.d location?? - # or the 'default' cloud.cfg location??? - base_cfgs.append(util.read_conf_with_confd(CLOUD_CONFIG)) - - # Kernel/cmdline parameters override system config - kern_contents = util.read_cc_from_cmdline() - if kern_contents: - base_cfgs.append(util.load_yaml(kern_contents, default={})) - - # And finally the default gets to play - if default_cfg: - base_cfgs.append(default_cfg) - - return util.mergemanydict(base_cfgs) + return util.mergemanydict( + [ + # builtin config + util.get_builtin_cfg(), + # Anything in your conf.d or 'default' cloud.cfg location. + util.read_conf_with_confd(CLOUD_CONFIG), + # Kernel/cmdline parameters override system config + util.read_conf_from_cmdline(), + ], reverse=True) def _pkl_store(obj, fname): |