Blame SOURCES/sos-bz1236111-activemq-collect-logs-config.patch

c81b6a
From e2a94de2e574b61d1da071f961863d2490c90bc0 Mon Sep 17 00:00:00 2001
c81b6a
From: =?UTF-8?q?Pep=20Turr=C3=B3=20Mauri?= <pep@redhat.com>
c81b6a
Date: Tue, 23 Dec 2014 19:36:29 +0100
c81b6a
Subject: [PATCH] [activemq] Honour all_logs and get config on RHEL
c81b6a
MIME-Version: 1.0
c81b6a
Content-Type: text/plain; charset=UTF-8
c81b6a
Content-Transfer-Encoding: 8bit
c81b6a
c81b6a
Get only current log file by default, allowing full dir
c81b6a
collection via the all_logs option.
c81b6a
c81b6a
Add a Red Hat version of the plugin that collects the two
c81b6a
main configuration files for activemq. Also enable that plugin
c81b6a
in the OpenShift profile.
c81b6a
c81b6a
Related: RHBZ#1165878
c81b6a
Fixes: #457.
c81b6a
c81b6a
Signed-off-by: Pep TurrĂ³ Mauri <pep@redhat.com>
c81b6a
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
c81b6a
---
c81b6a
 sos/plugins/activemq.py | 31 ++++++++++++++++++++++++++++---
c81b6a
 1 file changed, 28 insertions(+), 3 deletions(-)
c81b6a
c81b6a
diff --git a/sos/plugins/activemq.py b/sos/plugins/activemq.py
c81b6a
index 291fcd9..1594229 100644
c81b6a
--- a/sos/plugins/activemq.py
c81b6a
+++ b/sos/plugins/activemq.py
c81b6a
@@ -16,17 +16,42 @@
c81b6a
 from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
c81b6a
 
c81b6a
 
c81b6a
-class ActiveMq(Plugin, RedHatPlugin, DebianPlugin):
c81b6a
+class ActiveMq(Plugin, DebianPlugin):
c81b6a
     """ActiveMQ message broker
c81b6a
     """
c81b6a
 
c81b6a
     plugin_name = 'activemq'
c81b6a
-    profiles = ()
c81b6a
+    profiles = ('openshift',)
c81b6a
     packages = ('activemq', 'activemq-core')
c81b6a
     files = ('/var/log/activemq',)
c81b6a
 
c81b6a
     def setup(self):
c81b6a
-        self.add_copy_spec(list(self.files))
c81b6a
+        if self.get_option("all_logs"):
c81b6a
+            self.add_copy_spec(list(self.files))
c81b6a
+        else:
c81b6a
+            self.add_copy_spec([
c81b6a
+                "/var/log/activemq/activemq.log",
c81b6a
+                "/var/log/activemq/wrapper.log"
c81b6a
+            ])
c81b6a
+
c81b6a
+    def postproc(self):
c81b6a
+        # activemq.xml contains credentials in this form:
c81b6a
+        #   <authenticationUser ... password="changeme" ... />
c81b6a
+        self.do_file_sub(
c81b6a
+            '/etc/activemq/activemq.xml',
c81b6a
+            r'(\s*password=")[^"]*(".*)',
c81b6a
+            r"\1******\2"
c81b6a
+        )
c81b6a
+
c81b6a
+
c81b6a
+class RedHatActiveMq(ActiveMq, RedHatPlugin):
c81b6a
+
c81b6a
+    def setup(self):
c81b6a
+        super(RedHatActiveMq, self).setup()
c81b6a
+        self.add_copy_spec([
c81b6a
+            '/etc/sysconfig/activemq',
c81b6a
+            '/etc/activemq/activemq.xml'
c81b6a
+        ])
c81b6a
 
c81b6a
 
c81b6a
 class UbuntuActiveMq(ActiveMq, UbuntuPlugin):
c81b6a
-- 
c81b6a
1.8.3.1
c81b6a