From 058dd753b91126a504a82d4a48305e9d56116f73 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Wed, 7 Sep 2016 13:47:38 -0400 Subject: 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 --- cloudinit/config/cc_apt_configure.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'cloudinit/config') 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: -- cgit v1.2.3