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

New Parser RabbitMQReportOfContainers #2050

Merged
merged 1 commit into from
Jul 11, 2019
Merged
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
11 changes: 11 additions & 0 deletions insights/parsers/rabbitmq.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
RabbitMQReport - command ``/usr/sbin/rabbitmqctl report``
---------------------------------------------------------

RabbitMQReportOfContainers - files ``docker_exec_-t_rabbitmq-bundle-docker-*_rabbitmqctl_report``
-------------------------------------------------------------------------------------------------

RabbitMQUsers - command ``/usr/sbin/rabbitmqctl list_users``
------------------------------------------------------------

Expand Down Expand Up @@ -132,6 +135,14 @@ def parse_content(self, content):
self.result = create_parser().parseString("\n".join(content)).asDict()


@parser(Specs.rabbitmq_report_of_containers)
class RabbitMQReportOfContainers(RabbitMQReport):
"""
Parse the `rabbitmqctl report` command of each container running on the host.
"""
pass


@parser(Specs.rabbitmq_users)
class RabbitMQUsers(CommandParser):

Expand Down
14 changes: 13 additions & 1 deletion insights/parsers/tests/test_rabbitmq_report.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from insights.core.context import OSP
from insights.contrib.pyparsing import ParseException as PyparsingParseException
from insights.parsers.rabbitmq import RabbitMQReport
from insights.parsers.rabbitmq import RabbitMQReport, RabbitMQReportOfContainers
from insights.tests import context_wrap

osp_controller = OSP()
Expand Down Expand Up @@ -252,3 +252,15 @@ def test_rabbitmq_report_with_parse_exception():
assert False
except PyparsingParseException:
assert True


def test_rabbitmq_report_of_containers():
result = RabbitMQReportOfContainers(context_wrap(RABBITMQCTL_REPORT_1,
hostname="controller_1", osp=osp_controller)).result
assert result.get("nstat").get("rabbit@rabbitmq0").\
get("file_descriptors").get("total_limit") == "924"
permissions = {'/': {'redhat1': ['redhat.*', '.*', '.*'],
'guest': ['.*', '.*', '.*'],
'redhat': ['redhat.*', '.*', '.*']},
'test_vhost': ''}
assert result.get("perm") == permissions
1 change: 1 addition & 0 deletions insights/specs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ class Specs(SpecSet):
rabbitmq_policies = RegistryPoint()
rabbitmq_queues = RegistryPoint()
rabbitmq_report = RegistryPoint()
rabbitmq_report_of_containers = RegistryPoint(multi_output=True)
rabbitmq_startup_err = RegistryPoint(filterable=True)
rabbitmq_startup_log = RegistryPoint(filterable=True)
rabbitmq_users = RegistryPoint()
Expand Down
1 change: 1 addition & 0 deletions insights/specs/sos_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class SosSpecs(Specs):
simple_file("sos_commands/foreman/foreman-debug/qpid-stat-u")
])
rabbitmq_report = simple_file("sos_commands/rabbitmq/rabbitmqctl_report")
rabbitmq_report_of_containers = glob_file("sos_commands/rabbitmq/docker_exec_-t_rabbitmq-bundle-docker-*_rabbitmqctl_report")
rhn_charsets = first_file(["sos_commands/satellite/rhn-charsets", "sos_commands/rhn/rhn-charsets"])
root_crontab = first_file(["sos_commands/crontab/root_crontab", "sos_commands/cron/root_crontab"])
route = simple_file("sos_commands/networking/route_-n")
Expand Down