apt-config conflict check for apt: mirrors vs apt_mirrors seems wrong

Bug #2008909 reported by Olivier Gayot
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
curtin (Ubuntu)
New
Undecided
Unassigned

Bug Description

Curtin apt-config has support for converting some old apt related directives into the new format, where everything is wrapped inside the `apt` key.

This includes debconf-selections, proxy settings and mirrors.

For each "component", the code tries to detect conflicts, where a conflict is characterized by the presence of directives in both the old and new format at the same time.

For the mirrors part specifically, the conflict detection looks for the presence of `apt_mirrors` and `apt: mirrors` keys.

https://git.launchpad.net/curtin/tree/curtin/commands/apt_config.py?id=5af09277662422d7301a67e547d2115ee103e072#n709

    if cfg.get('apt_mirrors') is not None:
        if predef_apt_cfg.get('mirrors') 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)

That said, I can't find any other mention of the `apt: mirrors` key anywhere.
I believe we intend to check for the presence of `apt: primary` or `apt: security` instead. Maybe it is just a matter of doing:

     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 check if this was broken from the get go or if I overlooked something.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.