cloud-init-dev team mailing list archive
-
cloud-init-dev team
-
Mailing list archive
-
Message #00037
[Merge] lp:~utlemming/cloud-init/merge_config.1041384 into lp:cloud-init
Ben Howard has proposed merging lp:~utlemming/cloud-init/merge_config.1041384 into lp:cloud-init.
Requested reviews:
cloud init development team (cloud-init-dev)
Related bugs:
Bug #1041384 in cloud-init: "userless conf fails assign user[0] as the default user"
https://bugs.launchpad.net/cloud-init/+bug/1041384
For more details, see:
https://code.launchpad.net/~utlemming/cloud-init/merge_config.1041384/+merge/121295
Allow distribution defaults to be overridden via environmental, cloud-config,
or kernel commandline options. (LP: #1041384).
---
This is a simple change. Instead of merging all the configurations blindly this change:
1. Merges all run time configurations first
2. Merge only options not defined in run time options from the base options.
--
https://code.launchpad.net/~utlemming/cloud-init/merge_config.1041384/+merge/121295
Your team cloud init development team is requested to review the proposed merge of lp:~utlemming/cloud-init/merge_config.1041384 into lp:cloud-init.
=== modified file 'cloudinit/helpers.py'
--- cloudinit/helpers.py 2012-07-10 03:34:10 +0000
+++ cloudinit/helpers.py 2012-08-24 22:18:18 +0000
@@ -246,9 +246,16 @@
cfgs.extend(self._get_env_configs())
cfgs.extend(self._get_instance_configs())
cfgs.extend(self._get_datasource_configs())
- if self._base_cfg:
- cfgs.append(self._base_cfg)
- return util.mergemanydict(cfgs)
+ override_cfgs = util.mergemanydict(cfgs)
+ base_cfgs = {}
+
+ # Apply base configuration only when not overridden
+ # elsewhere
+ for opt in self._base_cfg:
+ if opt not in override_cfgs:
+ base_cfgs[opt] = self._base_cfg[opt]
+
+ return util.mergemanydict([override_cfgs, base_cfgs])
@property
def cfg(self):