← Back to team overview

curtin-dev team mailing list archive

Re: [Merge] ~ogayot/curtin:curthooks-fix-apt-config-translation into curtin:master

 


Diff comments:

> diff --git a/curtin/commands/apt_config.py b/curtin/commands/apt_config.py
> index f9cce34..e02327a 100644
> --- a/curtin/commands/apt_config.py
> +++ b/curtin/commands/apt_config.py
> @@ -714,6 +713,7 @@ def translate_old_apt_features(cfg):
>              raise ValueError(msg)
>  
>          old = cfg.get('apt_mirrors')
> +        cfg.setdefault('apt', {})

Sure! If you don't mind, I'll do a follow on PR for it, because another fix is needed, I think.

The code to handle conflicts for mirrors between old and new format looks broken.
Reading the code, it looks like the exception would be raised if there is both a `apt: mirrors` key and a `apt_mirrors` key but I can't find any other mention of the `apt: mirrors` key anywhere.
I believe a proper fix would be:

     if cfg.get('apt_mirrors') is not None:
-        if predef_apt_cfg.get('mirrors') is not None:
+        if predef_apt_cfg.get('primary') is not None or predef_apt_cfg.get('security') is not None:
            msg = ("Error in apt_mirror configuration: "
                   "old and new format of apt features "
                   "are mutually exclusive")
            LOG.error(msg)
            raise ValueError(msg)

but I would like to investigate more and see if I overlooked something.

>          cfg['apt']['primary'] = [{"arches": ["default"],
>                                    "uri": old.get('ubuntu_archive')}]
>          cfg['apt']['security'] = [{"arches": ["default"],


-- 
https://code.launchpad.net/~ogayot/curtin/+git/curtin/+merge/437494
Your team curtin developers is subscribed to branch curtin:master.



References