diff options
author | Christian Ehrhardt <christian.ehrhardt@canonical.com> | 2016-05-23 16:12:18 +0200 |
---|---|---|
committer | Christian Ehrhardt <christian.ehrhardt@canonical.com> | 2016-05-23 16:12:18 +0200 |
commit | 2945e028477ddb031d9a51ada16d5b992380242a (patch) | |
tree | 99d9f630e0db45e08e3ca312361895b61358001a /cloudinit/config/cc_apt_configure.py | |
parent | e4968621c802062910d964c2d9c897d7124861b0 (diff) | |
download | vyos-cloud-init-2945e028477ddb031d9a51ada16d5b992380242a.tar.gz vyos-cloud-init-2945e028477ddb031d9a51ada16d5b992380242a.zip |
make sure we only handle list or dict apt_sources and bail out for others
Diffstat (limited to 'cloudinit/config/cc_apt_configure.py')
-rw-r--r-- | cloudinit/config/cc_apt_configure.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/cloudinit/config/cc_apt_configure.py b/cloudinit/config/cc_apt_configure.py index a25d6af1..dd199471 100644 --- a/cloudinit/config/cc_apt_configure.py +++ b/cloudinit/config/cc_apt_configure.py @@ -217,8 +217,8 @@ def add_sources(srclist, template_params=None, aa_repo_match=None): errorlist = [] # convert old list format to new dict based format + srcdict = {} if isinstance(srclist, list): - srcdict = {} fnfallbackused = None for srcent in srclist: if 'filename' not in srcent: @@ -235,8 +235,10 @@ def add_sources(srclist, template_params=None, aa_repo_match=None): # all with filename use that as key (matching new format) key = srcent['filename'] srcdict[key] = srcent - else: + elif isinstance(srclist, dict): srcdict = srclist + else: + errorlist.append(["srclist", "unknown apt_sources format"]) for filename in srcdict: ent = srcdict[filename] |