xolox/python-executor

Fail in official Debian docker image ( contains neither /etc/lsb_release nor lsb-release installed)

martin68 opened this issue · 1 comments

Similar to issue #10 , but this time the official Debian docker image debian:buster, (a.k.a debian:10, also debian:latest at the moment) contains neither /etc/lsb_release nor lsb-release installed. Here's the exception traceback:

Traceback (most recent call last):
  File "/home/.local/lib/python2.7/site-packages/apt_mirror_updater/cli.py", line 160, in main
    callback()
  File "/home/.local/lib/python2.7/site-packages/apt_mirror_updater/cli.py", line 179, in report_available_mirrors
    have_bandwidth = any(c.bandwidth for c in updater.ranked_mirrors)
  File "/home/.local/lib/python2.7/site-packages/property_manager/__init__.py", line 781, in __get__
    value = super(custom_property, self).__get__(obj, type)
  File "/home/.local/lib/python2.7/site-packages/apt_mirror_updater/__init__.py", line 277, in ranked_mirrors
    mirrors = sorted(self.available_mirrors, key=lambda c: c.sort_key, reverse=True)
  File "/home/.local/lib/python2.7/site-packages/property_manager/__init__.py", line 781, in __get__
    value = super(custom_property, self).__get__(obj, type)
  File "/home/.local/lib/python2.7/site-packages/apt_mirror_updater/__init__.py", line 125, in available_mirrors
    if self.release_is_eol:
  File "/home/.local/lib/python2.7/site-packages/property_manager/__init__.py", line 781, in __get__
    value = super(custom_property, self).__get__(obj, type)
  File "/home/.local/lib/python2.7/site-packages/apt_mirror_updater/__init__.py", line 341, in release_is_eol
    logger.debug("Checking whether %s is EOL ..", self.release)
  File "/home/.local/lib/python2.7/site-packages/property_manager/__init__.py", line 781, in __get__
    value = super(custom_property, self).__get__(obj, type)
  File "/home/.local/lib/python2.7/site-packages/apt_mirror_updater/__init__.py", line 310, in release
    return coerce_release(self.distribution_codename)
  File "/home/.local/lib/python2.7/site-packages/apt_mirror_updater/releases.py", line 114, in coerce_release
    raise ValueError(msg % value)
ValueError: The string u'' doesn't match a known Debian or Ubuntu release!

So I think using /etc/lsb_release or lsb-release is not robust nowadays, I suggest using string in /etc/apt/sources.list as my fork of apt-mirror-updater, please see commit

xolox commented

Hi @martin68 and thanks for the feedback. I've just published release 23.0 which resolves this issue by falling back to parsing /etc/apt/sources.list as you suggested.