summaryrefslogtreecommitdiff
path: root/cloudinit/config/cc_apt_configure.py
diff options
context:
space:
mode:
authorScott Moser <smoser@brickies.net>2016-09-07 13:47:38 -0400
committerScott Moser <smoser@brickies.net>2016-09-08 09:19:02 -0400
commit058dd753b91126a504a82d4a48305e9d56116f73 (patch)
treea848b4fb6a936be7f8f9776f35e90d50ac1d3de4 /cloudinit/config/cc_apt_configure.py
parenta757c678f225c4b3da9d632a52c15fd667daebbf (diff)
downloadvyos-cloud-init-058dd753b91126a504a82d4a48305e9d56116f73.tar.gz
vyos-cloud-init-058dd753b91126a504a82d4a48305e9d56116f73.zip
apt config conversion: treat empty string as not provided.
Old behavior allowed a user to provide: apt_mirror: "" And that was the same as: apt_mirror: null and the same as having not specified apt_mirror at all. This maintains that behavior for all old string values. LP: #1621180
Diffstat (limited to 'cloudinit/config/cc_apt_configure.py')
-rw-r--r--cloudinit/config/cc_apt_configure.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/cloudinit/config/cc_apt_configure.py b/cloudinit/config/cc_apt_configure.py
index 42c56418..fa9505a7 100644
--- a/cloudinit/config/cc_apt_configure.py
+++ b/cloudinit/config/cc_apt_configure.py
@@ -477,8 +477,11 @@ def convert_v2_to_v3_apt_format(oldcfg):
'add_apt_repo_match': 'add_apt_repo_match'}
needtoconvert = []
for oldkey in mapoldkeys:
- if oldcfg.get(oldkey, None) is not None:
- needtoconvert.append(oldkey)
+ if oldkey in oldcfg:
+ if oldcfg[oldkey] in (None, ""):
+ del oldcfg[oldkey]
+ else:
+ needtoconvert.append(oldkey)
# no old config, so no new one to be created
if not needtoconvert: