diff options
author | Jake Hunsaker <jhunsake@redhat.com> | 2023-05-03 16:38:30 -0400 |
---|---|---|
committer | Jake Hunsaker <jhunsake@redhat.com> | 2023-05-09 13:23:28 -0400 |
commit | 071e33a7dd61ca13664f714d14a8db0700382af1 (patch) | |
tree | bdba3600d779a780309d92d0be3c0731a06e1981 /tests/unittests/policy_tests.py | |
parent | f1a0ae1a469da5ecedd7faa7ce67bbf60eb93cb2 (diff) | |
download | sos-071e33a7dd61ca13664f714d14a8db0700382af1.tar.gz |
[package_managers] Add MultiPackageManager support for policies
Adds a new `MultiPackageManager` class to handle systems that have
multiple distinct package managers on them.
This initial implementation requires policies that will leverage this to
define a `primary` package manager, and at least one fallback package
manager. Policies will need to pass the uninstantiated class object to
the initializing call to `MultiPackageManager`, for example:
self.pkgman = MultiPackageManager(primary=RpmPackageManager,
fallbacks=[DpkgPackageManager])
When a call to a `PackageManager` method is made to
`MultiPackageManager`, the call is first directed to the primary
manager. If that response is empty, None, etc... then the call is
forwarded to each of the fallback managers in the order they were
defined, until either a non-empty response is returned or we run out of
fallbacks to try.
In order to allow for some introspection of which defined manager
provides a non-empty response for package queries, a new `pkg_manager`
entry in the contents of the `packages` property has been added.
Closes: #2237
Related: #3214
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
Diffstat (limited to 'tests/unittests/policy_tests.py')
0 files changed, 0 insertions, 0 deletions