Skip to content

use distro python module instead of lsb_release binary #10

Description

@FooBarQuaxx

I've tried to use apt-mirror-updater from a vanilla Ubuntu 18.04 docker image to set the fastest apt mirrors. I've encountered an error because python-executor relies on lsb_release binary to fetch the distribution codename and id. Here's the exception traceback:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/apt_mirror_updater/cli.py", line 160, in main
    callback()
  File "/usr/local/lib/python2.7/dist-packages/apt_mirror_updater/__init__.py", line 425, in change_mirror
    new_mirror = self.best_mirror
  File "/usr/local/lib/python2.7/dist-packages/property_manager/__init__.py", line 781, in __get__
    value = super(custom_property, self).__get__(obj, type)
  File "/usr/local/lib/python2.7/dist-packages/apt_mirror_updater/__init__.py", line 176, in best_mirror
    if self.release_is_eol:
  File "/usr/local/lib/python2.7/dist-packages/property_manager/__init__.py", line 781, in __get__
    value = super(custom_property, self).__get__(obj, type)
  File "/usr/local/lib/python2.7/dist-packages/apt_mirror_updater/__init__.py", line 343, in release_is_eol
    if hasattr(self.backend, 'get_eol_date'):
  File "/usr/local/lib/python2.7/dist-packages/property_manager/__init__.py", line 781, in __get__
    value = super(custom_property, self).__get__(obj, type)
  File "/usr/local/lib/python2.7/dist-packages/apt_mirror_updater/__init__.py", line 164, in backend
    return sys.modules[module_path]
  File "/usr/local/lib/python2.7/dist-packages/apt_mirror_updater/__init__.py", line 164, in backend
    return sys.modules[module_path]

I've debugged the value of self.distribution_id and self.distribution_codename and both are empty.

Since there's no obvious way to enforce the existence of lsb_release inside a python module definition, I suggest using python distro module to get that information.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions