Replacing dependency on Ubuntu-specific /etc/lsb-release dependency to allow landscape-package-reporter to work with Debian

Bug #1990268 reported by Chris Hill
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Landscape Client
Fix Committed
Wishlist
Mitch Burton

Bug Description

According to the FAQ 'We don't test landscape-client on Debian, but we don't really try to make it difficult for Debian users.' (https://help.landscape.canonical.com/FAQ#Does_landscape-client_work_with_Debian.3F)

I have paid for and been trialling landscape-client on Debian 9 and 10 (Jessie/Buster) and does indeed work remarkably well - computers can be added, monitoring works and in general all seems happy. The only exception is with 'landscape-package-reporter' which returns an error because '/etc/lsb-release' does not exist (see error log below).

This appears to be a conscious decision by the Debian project as they didn't believe it was necessary for LSB compatibility https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=444678 - although the command /usr/bin/lsb_release provides the same information and *is* shared with Ubuntu.

If I manually create the relevant file on Debian with /usr/bin/lsb-release, everything else works perfectly:

apt install lsb-release
echo DISTRIB_ID=$(lsb_release -si) > /etc/lsb-release
echo DISTRIB_RELEASE=$(lsb_release -sr) >> /etc/lsb-release
echo DISTRIB_CODENAME=$(lsb_release -sc) >> /etc/lsb-release
echo DISTRIB_DESCRIPTION=\"$(lsb_release -sd)\" >> /etc/lsb-release

This allows landscape-package-reporter to run and removes the 'No package information is available for the selected computers' warning in the Landscape console which otherwise appears.

I was wondering if you could update landscape-package-reporter to use lsb_release instead of /etc/lsb-release. I am aware that Debian is unsupported. But a small, hopefully insignificant change like this would mean it could work on both, which many people including myself looking for a nice updating GUI for their Debian installs would find very helpful!

Hoping you agree :)

--

2022-09-20 13:33:52,570 WARNING [MainThread] Couldn't determine which hash=>id database to use: [Errno 2] No such file or directory: '/etc/lsb-release'
2022-09-20 13:33:52,576 WARNING [MainThread] Couldn't determine which hash=>id database to use: [Errno 2] No such file or directory: '/etc/lsb-release'
2022-09-20 13:33:52,634 INFO [MainThread] Received 500 package hash => id translations, 0 hashes are unknown.
2022-09-20 13:35:32,215 INFO [MainThread] Queuing request for package hash => id translation on 500 hash(es).
2022-09-20 13:35:32,262 ERROR [MainThread] None
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 654, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/lib/python3/dist-packages/landscape/client/package/reporter.py", line 95, in <lambda>
    result.addCallback(lambda x: self.detect_changes())
  File "/usr/lib/python3/dist-packages/landscape/client/package/reporter.py", line 556, in detect_changes
    deferred = self.detect_packages_changes()
  File "/usr/lib/python3/dist-packages/landscape/client/package/reporter.py", line 565, in detect_packages_changes
    return self._compute_packages_changes()
  File "/usr/lib/python3/dist-packages/landscape/client/package/reporter.py", line 631, in _compute_packages_changes
    lsb = parse_lsb_release(LSB_RELEASE_FILENAME)
  File "/usr/lib/python3/dist-packages/landscape/lib/lsb_release.py", line 15, in parse_lsb_release
    fd = open(lsb_release_filename, "r")
FileNotFoundError: [Errno 2] No such file or directory: '/etc/lsb-release'

Revision history for this message
Mitch Burton (mitchburton) wrote (last edit ):

I'm not against the idea, and it seems relatively low-impact to implement. Comes with the caveat that certain Landscape features may not work as designed, though - can't guarantee security updates/CVEs will necessarily be accurately reported.

With that in mind, I'm happy to implement it (eventually) or merge a PR to https://github.com/CanonicalLtd/landscape-client

Changed in landscape-client:
importance: Undecided → Wishlist
status: New → Triaged
Revision history for this message
Chris Hill (chrisatmaf) wrote :

Hey, completely understand - not expecting official support.

I've put together a potential PR here: https://github.com/CanonicalLtd/landscape-client/pull/115 - didn't realise the source code was available, otherwise I'd have done this before.

I'm afraid updating the tests is beyond my skills, but hoping someone with more knowledge might be able to help out here!

Changed in landscape-client:
status: Triaged → In Progress
assignee: nobody → Mitch Burton (mitchburton)
Revision history for this message
Chris Hill (chrisatmaf) wrote :

Hey, now that this has been merged, could you let me know if there's a timeframe for release? :)

Revision history for this message
Mitch Burton (mitchburton) wrote (last edit ):

We don't have a hard timeline yet for when this will be released. If you've got a burning need for it, you can get the latest debs from the beta PPA (https://launchpad.net/~landscape/+archive/ubuntu/self-hosted-beta/) or build them from the github source.

Changed in landscape-client:
status: In Progress → Fix Committed
Revision history for this message
Chris Hill (chrisatmaf) wrote :

Thanks for the update, and for updating the status :)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.