Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pulp,katello] move qpid-stat commands to pulp plugin #1805

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions sos/plugins/katello.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from sos.plugins import Plugin, RedHatPlugin
from pipes import quote
import os.path


class Katello(Plugin, RedHatPlugin):
Expand All @@ -25,17 +24,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]
# certfile: /etc/pki/katello/qpid_client_striped.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