canonical / ubuntu-pro-client

Ubuntu Pro Client for offerings from Canonical
https://canonical-ubuntu-pro-client.readthedocs-hosted.com/en/latest/
GNU General Public License v3.0
52 stars 73 forks source link

Feature: Create a fallback mechanism for checking repos with `apt-cache policy` #3066

Open WizardBit opened 5 months ago

WizardBit commented 5 months ago

Please describe the scenario where the new feature would be useful For those who use internal mirrored repositories for ESM packages.

What is the situation that made you realize this feature is necessary?

Attempting to enable fips-updates with an internal mirror.

Describe the solution you'd like

The issue is with this part of the code explicitly checking for the origin of the repo to match with "Ubuntu". A fallback mechanism to forcefully bypass this check if a user decides and understands the implications.

/usr/lib/python3/dist-packages/uaclient/apt.py

    for line in policy.splitlines():
        # We only care about $suite-updates lines
        if "a={}-updates".format(series) not in line:
            continue
        # We only care about $suite-updates from the Ubuntu archive
        if "o=Ubuntu," not in line:
            continue
        updates_enabled = True
        break

Is this partially implemented somehow? Is there any alternative way to solve the problem?

At the moment the work around is to manually edit the code to set updates_enabled = True after the code block above, then enabled fips-updates. Alternatively, fips-updates can be enabled before changing to internal mirrors.