diff options
author | Christian Ehrhardt <christian.ehrhardt@canonical.com> | 2016-05-23 12:12:26 +0200 |
---|---|---|
committer | Christian Ehrhardt <christian.ehrhardt@canonical.com> | 2016-05-23 12:12:26 +0200 |
commit | a33f8c09863381006f708a1e9d49997ed9f7befa (patch) | |
tree | ab5e070b120f68b1318f389eeaacc331d5286ed7 /cloudinit | |
parent | ee239517c5342cbd62c9fdeaf735d78d6fd1fbb8 (diff) | |
download | vyos-cloud-init-a33f8c09863381006f708a1e9d49997ed9f7befa.tar.gz vyos-cloud-init-a33f8c09863381006f708a1e9d49997ed9f7befa.zip |
warn about multiple colliding apt_source without filenames
Diffstat (limited to 'cloudinit')
-rw-r--r-- | cloudinit/config/cc_apt_configure.py | 8 |
1 files changed, 7 insertions, 1 deletions
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: |