diff options
author | Jake Hunsaker <jhunsake@redhat.com> | 2018-12-26 20:35:24 -0500 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2019-03-21 16:23:26 +0000 |
commit | 96573990f0c66064fdac905d69c469613b7aa2d9 (patch) | |
tree | fbef432575b246909cd450e333d88958398f95e1 | |
parent | 611e4ab9a595753e61d7c052bf6a91242bcd19e3 (diff) | |
download | sos-96573990f0c66064fdac905d69c469613b7aa2d9.tar.gz |
[candlepin] Add new plugin
Adds a new plugin for Candlepin as part of the effort to port the
foreman-debug script to native sos plugins.
Related: #1525
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/plugins/candlepin.py | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/sos/plugins/candlepin.py b/sos/plugins/candlepin.py new file mode 100644 index 00000000..d02a80fd --- /dev/null +++ b/sos/plugins/candlepin.py @@ -0,0 +1,47 @@ +# Copyright (C) 2018 Red Hat, Inc., Jake Hunsaker <jhunsake@redhat.com> + +# 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.plugins import Plugin, RedHatPlugin + + +class Candlepin(Plugin, RedHatPlugin): + """Candlepin entitlement management""" + + plugin_name = 'candlepin' + packages = ('candlepin',) + + def setup(self): + + # Always collect the full active log of these + self.add_copy_spec([ + "/var/log/candlepin/error.log", + "/var/log/candlepin/candlepin.log" + ], sizelimit=0) + + # Allow limiting on logrotated logs + self.add_copy_spec([ + "/etc/candlepin/candlepin.conf", + "/var/log/candlepin/audit*.log*", + "/var/log/candlepin/candlepin.log-*", + "/var/log/candlepin/cpdb*.log*", + "/var/log/candlepin/cpinit*.log*", + "/var/log/candlepin/error.log-*" + ]) + + self.add_cmd_output("du -sh /var/lib/candlepin/*/*") + + def postproc(self): + reg = r"(((.*)(pass|token|secret)(.*))=)(.*)" + repl = r"\1********" + self.do_file_sub("/etc/candlepin/candlepin.conf", reg, repl) + cpdbreg = r"(--password=)([a-zA-Z0-9]*)" + self.do_file_sub("/var/log/candlepin/cpdb.log", cpdbreg, repl) + +# vim: set et ts=4 sw=4 : |