[Merge] ~renanrodrigo/update-notifier:respect-phasing into update-notifier:master

Athos Ribeiro mp+438009 at code.launchpad.net
Tue Feb 28 21:08:53 UTC 2023


Review: Needs Information



Diff comments:

> diff --git a/data/apt_check.py b/data/apt_check.py
> index 44bfd08..f4c68e6 100755
> --- a/data/apt_check.py
> +++ b/data/apt_check.py
> @@ -325,6 +325,29 @@ def has_esm_service(cache, esm_origin):
>      return False
>  
>  
> +def get_apt_pkg_esm_cache():
> +    """Get an apt_pkg cache with the ubuntu-advantage-tools esm data.
> +
> +    Set the configuration to get the u-a-t cache, then set it back to an empty
> +    configuration state and init again so other calls to Cache work as expected.
> +    """
> +    for key in apt_pkg.config.keys():
> +        if "Acquire" not in key:

I suppose you are trying to preserve any rules related to how packages are downloaded here. If this is the case, should we match r'^Acquire::' instead? This would avoid preserving the current Debug options that contain Acquire in the string (and any future options that may contain that string but do not belong to the Acquire group).

> +            apt_pkg.config.clear(key)
> +    apt_pkg.config.set("Dir", "/var/lib/ubuntu-advantage/apt-esm/")

Nitpick: this path could be a constant, as the SYNAPTIC_PINFILE one.

> +    apt_pkg.init()
> +    try:
> +        esm_cache = apt_pkg.Cache(progress=None)

I am not sure what errors we are expecting here, could you please clarify that? I'd like to understand why the calls to init and config.set were removed from the try/except block. Isn't apt_pkg.Error concealing any system errors anyway?

> +    except apt_pkg.Error:
> +        esm_cache = None
> +
> +    for key in apt_pkg.config.keys():
> +        apt_pkg.config.clear(key)
> +    apt_pkg.init()
> +
> +    return esm_cache
> +
> +
>  def init():
>      " init the system, be nice "
>      # FIXME: do a ionice here too?


-- 
https://code.launchpad.net/~renanrodrigo/update-notifier/+git/update-notifier/+merge/438009
Your team Ubuntu Core Development Team is subscribed to branch update-notifier:master.




More information about the Ubuntu-reviews mailing list