apt-smart icon indicating copy to clipboard operation
apt-smart copied to clipboard

distribution_codename() seems broken on Ubuntu 22.04

Open nergdron opened this issue 2 years ago • 0 comments

attempting to test apt-smart on the latest Ubuntu LTS, and it fails in the most basic use case, can't seem to detect the release name from /etc/apt/sources.list, even though it's the default config:

# docker run -it ubuntu:22.04
root@31c59159a087:/# apt update && apt install -y python3-pip
[ apt installing ]
root@31c59159a087:/# pip install apt-smart
[ pip installing ]
root@31c59159a087:/# apt-smart -a
2022-05-16 16:45:57 31c59159a087 apt_smart[4205] INFO Changing mirror of local system (31c59159a087) to best available mirror ..
2022-05-16 16:45:57 31c59159a087 apt_smart.cli[4205] ERROR Encountered unexpected exception! Aborting ..
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/apt_smart/cli.py", line 211, in main
    callback()
  File "/usr/local/lib/python3.10/dist-packages/apt_smart/__init__.py", line 589, in change_mirror
    new_mirror = self.best_mirror
  File "/usr/local/lib/python3.10/dist-packages/property_manager3/__init__.py", line 784, in __get__
    value = super(custom_property, self).__get__(obj, type)
  File "/usr/local/lib/python3.10/dist-packages/apt_smart/__init__.py", line 203, in best_mirror
    logger.debug("Selecting best %s mirror ..", self.distributor_id.capitalize())
  File "/usr/local/lib/python3.10/dist-packages/property_manager3/__init__.py", line 784, in __get__
    value = super(custom_property, self).__get__(obj, type)
  File "/usr/local/lib/python3.10/dist-packages/apt_smart/__init__.py", line 313, in distributor_id
    return self.release.distributor_id
  File "/usr/local/lib/python3.10/dist-packages/property_manager3/__init__.py", line 784, in __get__
    value = super(custom_property, self).__get__(obj, type)
  File "/usr/local/lib/python3.10/dist-packages/apt_smart/__init__.py", line 447, in release
    return coerce_release(self.distribution_codename)
  File "/usr/local/lib/python3.10/dist-packages/property_manager3/__init__.py", line 784, in __get__
    value = super(custom_property, self).__get__(obj, type)
  File "/usr/local/lib/python3.10/dist-packages/apt_smart/__init__.py", line 298, in distribution_codename
    raise EnvironmentError("Failed to determine the distribution codename using apt's package resource list!")
OSError: Failed to determine the distribution codename using apt's package resource list!

note that this could probably be fixed by resolving issue #10.

nergdron avatar May 16 '22 16:05 nergdron