diff --git a/sos/policies/distros/redhat.py b/sos/policies/distros/redhat.py index 15241e2782..bdbe8f9529 100644 --- a/sos/policies/distros/redhat.py +++ b/sos/policies/distros/redhat.py @@ -19,6 +19,8 @@ ATOMIC) from sos.policies.distros import LinuxPolicy, ENV_HOST_SYSROOT from sos.policies.package_managers.rpm import RpmPackageManager +from sos.policies.package_managers.flatpak import FlatpakPackageManager +from sos.policies.package_managers import MultiPackageManager from sos.utilities import bold from sos import _sos as _ @@ -57,8 +59,11 @@ def __init__(self, sysroot=None, init=None, probe_runtime=True, remote_exec=remote_exec) self.usrmove = False - self.package_manager = RpmPackageManager(chroot=self.sysroot, - remote_exec=remote_exec) + self.package_manager = MultiPackageManager( + primary=RpmPackageManager, + fallbacks=[FlatpakPackageManager], + chroot=self.sysroot, + remote_exec=remote_exec) self.valid_subclasses += [RedHatPlugin] diff --git a/sos/policies/package_managers/flatpak.py b/sos/policies/package_managers/flatpak.py new file mode 100644 index 0000000000..7e171aa5df --- /dev/null +++ b/sos/policies/package_managers/flatpak.py @@ -0,0 +1,30 @@ +# Copyright 2023 Red Hat, Inc. Jose Castillo + +# This file is part of the sos project: https://github.com/sosreport/sos +# +# This copyrighted material is made available to anyone wishing to use, +# modify, copy, or redistribute it subject to the terms and conditions of +# version 2 of the GNU General Public License. +# +# See the LICENSE file in the source distribution for further information. + +from sos.policies.package_managers import PackageManager + + +class FlatpakPackageManager(PackageManager): + """Package Manager for Flatpak distributions + """ + + query_command = 'flatpak list --columns=name,version' + query_path_command = '' + files_command = '' + verify_command = '' + verify_filter = '' + + def _parse_pkg_list(self, pkg_list): + for line in pkg_list.splitlines(): + pkg = line.split() + name, version = pkg[0], pkg[1] + yield (name, version, None) + +# vim: set et ts=4 sw=4 :