diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2017-08-31 13:34:29 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2017-11-01 14:17:59 +0000 |
commit | fa91ce0576b450b7280301084ae74b8475bf37b9 (patch) | |
tree | 37f709768384f46030e8c3d9f41b05702269ba7f | |
parent | 82e4ee224706b5eb377b35f88c852dd79c7cb25d (diff) | |
download | sos-fa91ce0576b450b7280301084ae74b8475bf37b9.tar.gz |
[Plugin] automatic verify for plugins with a packages list
If a plugin defines 'packages' but not 'verify_packages', use the
package list to automatically generate a list of packages to be
verified when --verify is given.
Only the base names are used; each entry in the package list has
the '$' end-of-line match character. This prevents verification
of very large numbers of packages for plugins with package names
that are a common prefix (e.g. 'python-' and 'perl-').
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/plugins/__init__.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py index 995989b9..aa69b19d 100644 --- a/sos/plugins/__init__.py +++ b/sos/plugins/__init__.py @@ -957,7 +957,12 @@ class Plugin(object): def setup_verify(self): if not hasattr(self, "verify_packages") or not self.verify_packages: - return + if hasattr(self, "packages") and self.packages: + # Limit automatic verification to only the named packages + self.verify_packages = [p + "$" for p in self.packages] + else: + return + pm = self.policy().package_manager verify_cmd = pm.build_verify_command(self.verify_packages) if verify_cmd: |