Skip to content

Commit

Permalink
[pulp,katello] move qpid-stat commands to pulp plugin
Browse files Browse the repository at this point in the history
These commands are rather pulp-related and they are required to be
collected also on Satellite6 Capsules where no katello but pulp
is present.

Resolves: #1805

Signed-off-by: Pavel Moravec <[email protected]>
  • Loading branch information
pmoravec committed Sep 30, 2019
1 parent 699e503 commit 025f964
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
11 changes: 0 additions & 11 deletions sos/plugins/katello.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,6 @@ def setup(self):
"/var/log/httpd/katello-reverse-proxy_error_ssl.log*"
])

# certificate file location relies on katello version, it can be either
# /etc/pki/katello/qpid_client_striped.crt (for older versions) or
# /etc/pki/pulp/qpid/client.crt (for newer versions)
cert = "/etc/pki/pulp/qpid/client.crt"
if not os.path.isfile(cert):
cert = "/etc/pki/katello/qpid_client_striped.crt"
self.add_cmd_output([
"qpid-stat -%s --ssl-certificate=%s -b amqps://localhost:5671" %
(opt, cert) for opt in "quc"
])

kat_db = self.build_query_cmd(
"select id,name,checksum_type,updated_at from katello_repositories"
)
Expand Down
15 changes: 15 additions & 0 deletions sos/plugins/pulp.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,16 @@ def setup(self):
# further, take optional user credentials - here we assume the
# credentials dont contain a whitespace character (that would
# make the parsing more difficult)
#
# further, collect location of CA file for contacting qpid in section
# [messaging]
# cacert: /etc/pki/katello/certs/katello-default-ca.crt
self.dbhost = "localhost"
self.dbport = "27017"
self.dbuser = ""
self.dbpassword = ""
self.messaging_cert_file = ""
in_messaging_section = False
try:
for line in open("/etc/pulp/server.conf").read().splitlines():
if match(r"^\s*seeds:\s+\S+:\S+", line):
Expand All @@ -45,6 +51,11 @@ def setup(self):
self.dbuser = "-u %s" % line.split()[1]
if match(r"\s*password:\s+\S+", line):
self.dbpassword = "-p %s" % line.split()[1]
if line.startswith("[messaging]"):
in_messaging_section = True
if in_messaging_section and line.startswith("certfile:"):
self.messaging_cert_file = line.split()[1]
in_messaging_section = False
except IOError:
# fallback when the cfg file is not accessible
pass
Expand Down Expand Up @@ -112,6 +123,10 @@ def setup(self):
self.add_cmd_output(prun, suggest_filename="pulp-running_tasks")
self.add_cmd_output(csizes, suggest_filename="mongo-collection_sizes")
self.add_cmd_output(dbstats, suggest_filename="mongo-db_stats")
self.add_cmd_output([
"qpid-stat -%s --ssl-certificate=%s -b amqps://localhost:5671" %
(opt, self.messaging_cert_file) for opt in "quc"
])

def build_mongo_cmd(self, query):
_cmd = "bash -c %s"
Expand Down

0 comments on commit 025f964

Please sign in to comment.