summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorharlowja <harlowja@virtualbox.rhel>2012-06-22 22:12:34 -0700
committerharlowja <harlowja@virtualbox.rhel>2012-06-22 22:12:34 -0700
commitca51606e4b6e194a35c6bf6d092703e12e55685d (patch)
treee37acdb4f3f108d088a112c6a14701c4228cfd6b
parent85d5753d549e2d6ff69bbcc946e37d8fdac44868 (diff)
downloadvyos-cloud-init-ca51606e4b6e194a35c6bf6d092703e12e55685d.tar.gz
vyos-cloud-init-ca51606e4b6e194a35c6bf6d092703e12e55685d.zip
1. Add comment about conf.d overriding input config
2. For reading config from conf.d, collect all the configs then call the mergemany function
-rw-r--r--cloudinit/util.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py
index 332b8379..4c521bc3 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -641,11 +641,10 @@ def read_conf_d(confd):
# remove anything not a file
confs = [f for f in confs if os.path.isfile(os.path.join(confd, f))]
- cfg = {}
- for conf in confs:
- cfg = mergedict(cfg, read_conf(os.path.join(confd, conf)))
-
- return cfg
+ cfgs = []
+ for fn in confs:
+ cfgs.append(read_conf(os.path.join(confd, fn))
+ return mergemanydict(cfgs)
def read_conf_with_confd(cfgfile):
@@ -667,8 +666,8 @@ def read_conf_with_confd(cfgfile):
if not confd or not os.path.isdir(confd):
return cfg
- cfg = mergedict(read_conf_d(confd), cfg)
- return cfg
+ # Conf.d settings override input configuration
+ return mergedict(read_conf_d(confd), cfg)
def read_cc_from_cmdline(cmdline=None):