utils: sw_inventory: report unknown OS for software inventory

Users can create an image of a filesystem that contains no OS, therefore,
instead of rising an exception when no OS is detected, deliver a "unknown"
OS and an empty list of software.
master v1.3.2-2
OpenGnSys Support Team 2023-11-13 21:01:52 +01:00
parent 4e10c46563
commit d34ef0ab25
1 changed files with 2 additions and 1 deletions

View File

@ -126,6 +126,7 @@ def get_package_set(mountpoint):
pkgset = _get_package_set_dpkg(dpkg_status_path)
osname = getlinuxversion(osrelease)
else:
raise ValueError(f'Cannot fetch software inventory at {mountpoint}')
pkgset = set()
osname = "unknown"
# Legacy software inventory first element is the OS name
return [osname] + list(pkgset)