From a33f8c09863381006f708a1e9d49997ed9f7befa Mon Sep 17 00:00:00 2001 From: Christian Ehrhardt Date: Mon, 23 May 2016 12:12:26 +0200 Subject: warn about multiple colliding apt_source without filenames --- cloudinit/config/cc_apt_configure.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'cloudinit/config/cc_apt_configure.py') diff --git a/cloudinit/config/cc_apt_configure.py b/cloudinit/config/cc_apt_configure.py index a46ebb3e..327b543e 100644 --- a/cloudinit/config/cc_apt_configure.py +++ b/cloudinit/config/cc_apt_configure.py @@ -215,15 +215,22 @@ def add_sources(srclist, template_params=None, aa_repo_match=None): def aa_repo_match(x): return False + errorlist = [] # convert old list format to new dict based format if isinstance(srclist, list): srcdict = {} + fnfallbackused = None for srcent in srclist: if 'filename' not in srcent: # file collides for multiple !filename cases for compatibility # yet we need them all processed, so not same dictionary key srcent['filename'] = "cloud_config_sources.list" key = util.rand_dict_key(srcdict, "cloud_config_sources.list") + if fnfallbackused is not None: + errorlist.append(["multiple apt_source entries without", + "filename will conflict: %s vs %s" % + (srcent, fnfallbackused)]) + fnfallbackused = srcent else: # all with filename use that as key (matching new format) key = srcent['filename'] @@ -231,7 +238,6 @@ def add_sources(srclist, template_params=None, aa_repo_match=None): else: srcdict = srclist - errorlist = [] for filename in srcdict: ent = srcdict[filename] if 'filename' not in ent: -- cgit v1.2.3