From fc4f832dc46aa74312761a6b2172d5e0a8f9f68d Mon Sep 17 00:00:00 2001 From: "Bryn M. Reeves" Date: Mon, 14 Apr 2014 19:56:41 +0100 Subject: Make OpenShift broker vs. node detection automatic Enable broker and node data collection by detecting the respective configuration files and automatically collect files and command output for the components present. Signed-off-by: Bryn M. Reeves --- sos/plugins/openshift.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/sos/plugins/openshift.py b/sos/plugins/openshift.py index d032b27e..a90702f1 100644 --- a/sos/plugins/openshift.py +++ b/sos/plugins/openshift.py @@ -13,18 +13,28 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. from sos.plugins import Plugin, RedHatPlugin +import os.path class Openshift(Plugin, RedHatPlugin): '''Openshift related information''' plugin_name = "openshift" + # The 'broker' and 'node' options are obsolete but are maintained + # here for compatibility with external programs that call sosreport + # with these names. option_list = [("broker", "Gathers broker specific files", "slow", False), ("node", "Gathers node specific files", "slow", False)] ruby = "ruby193" vendor ="rh" + def is_broker(self): + return os.path.exists("/etc/openshift/broker.conf") + + def is_node(self): + return os.path.exists("/etc/openshift/node.conf") + def setup(self): self.add_copy_specs([ "/etc/openshift-enterprise-version", @@ -34,7 +44,7 @@ class Openshift(Plugin, RedHatPlugin): self.add_cmd_output("oo-diagnostics") - if self.option_enabled("broker"): + if self.is_broker() self.add_copy_specs([ "/var/log/mcollective-client.log", "/var/log/openshift/broker/", @@ -50,8 +60,7 @@ class Openshift(Plugin, RedHatPlugin): runat = '/var/www/openshift/broker/' self.add_cmd_output("bundle --local", runat) - - if self.option_enabled("node"): + if self.is_node() self.add_copy_specs([ "/var/log/openshift/node", "/cgroup/*/openshift/", -- cgit