← Back to team overview

cloud-init-dev team mailing list archive

Re: [Merge] ~smoser/cloud-init:bug/1621180 into cloud-init:master

 


Diff comments:

> diff --git a/cloudinit/config/cc_apt_configure.py b/cloudinit/config/cc_apt_configure.py
> index 42c5641..76b8d64 100644
> --- a/cloudinit/config/cc_apt_configure.py
> +++ b/cloudinit/config/cc_apt_configure.py
> @@ -476,9 +477,13 @@ def convert_v2_to_v3_apt_format(oldcfg):
>                    'apt_custom_sources_list': 'sources_list',
>                    'add_apt_repo_match': 'add_apt_repo_match'}
>      needtoconvert = []
> +    oldcfg = copy.deepcopy(oldcfg)

how does deepcopy on an parameter, reassigned to the parameter work?
Does it really make a local copy that we can manipulate without modifying the
passed in value?  Is that what you're doing here?

>      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:


-- 
https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/305137
Your team cloud init development team is requested to review the proposed merge of ~smoser/cloud-init:bug/1621180 into cloud-init:master.


References