sos-collector/SOURCES/sos-collector-sat-support.patch
2021-09-10 04:42:13 +00:00

71 lines
2.6 KiB
Diff

From 096ce477d314d47aa805fae585dc5aac17810d8f Mon Sep 17 00:00:00 2001
From: Jake Hunsaker <jhunsake@redhat.com>
Date: Fri, 28 Dec 2018 14:21:40 -0500
Subject: [PATCH] [satellite] Add satellite a supported environment
Adds a profile for Satellite 6. While not technically a cluster, Sat 6
does have capsule servers that can be deployed concurrently to help with
load and distribution, so it still fits in with sos-collector's goal.
Many thanks to Paul Dudley from Red Hat for assistance in providing a
test environment for this work and identifying the need.
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
---
soscollector/clusters/satellite.py | 43 ++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
create mode 100644 soscollector/clusters/satellite.py
diff --git a/soscollector/clusters/satellite.py b/soscollector/clusters/satellite.py
new file mode 100644
index 0000000..ccdfefb
--- /dev/null
+++ b/soscollector/clusters/satellite.py
@@ -0,0 +1,43 @@
+# Copyright Red Hat 2018, Jake Hunsaker <jhunsake@redhat.com>
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+from pipes import quote
+from soscollector.clusters import Cluster
+
+
+class satellite(Cluster):
+ """Red Hat Satellite 6"""
+
+ packages = ('satellite', 'satellite-installer')
+
+ def _psql_cmd(self, query):
+ _cmd = "su postgres -c %s"
+ _dbcmd = "psql foreman -c %s"
+ return _cmd % quote(_dbcmd % quote(query))
+
+ def get_nodes(self):
+ cmd = self._psql_cmd('select name from smart_proxies')
+ res = self.exec_master_cmd(cmd, need_root=True)
+ if res['status'] == 0:
+ idx = 2
+ if 'could not change' in res['stdout']:
+ idx = 3
+ nodes = [n.strip() for n in res['stdout'].splitlines()[idx:-1]]
+ return nodes
+
+ def set_node_label(self, node):
+ if node.address == self.master.address:
+ return 'satellite'
+ return 'capsule'
--
2.14.5