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

pro security-status emits warning if ESM cache doesn't exist #3132

Closed lucasmoura closed 1 month ago

lucasmoura commented 4 months ago

Description of the bug

On Noble, if the pro security-status command runs before the ESM cache is created, we will see the following warning on stderr:

/usr/lib/python3/dist-packages/uaclient/apt.py:299: Warning: W:Unable to read /var/lib/ubuntu-advantage/apt-esm/etc/apt/apt.conf.d/ - DirectoryExists (2: No such file or directory)
  apt_pkg.init()
/usr/lib/python3/dist-packages/uaclient/apt.py:281: Warning: W:Unable to read /var/lib/ubuntu-advantage/apt-esm/etc/apt/preferences.d/ - DirectoryExists (2: No such file or directory)
  apt_pkg.init_system()

Expected behavior

This warning should not appear, even if the ESM cache doesn't exit

To Reproduce

Please include details on how to reproduce the bug.

  1. Launch a Noble container
  2. Run pro security-status | cat

System information: