From 96573990f0c66064fdac905d69c469613b7aa2d9 Mon Sep 17 00:00:00 2001 From: Jake Hunsaker Date: Wed, 26 Dec 2018 20:35:24 -0500 Subject: [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 Signed-off-by: Bryn M. Reeves --- sos/plugins/candlepin.py | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 sos/plugins/candlepin.py 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 + +# 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 : -- cgit