aboutsummaryrefslogtreecommitdiffstats
path: root/sos/report/plugins/aap_receptor.py
blob: 90155b789ca7d7ec8d89214a620b2958ea431f80 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Copyright (c) 2024 Rudnei Bertol Jr <rudnei@redhat.com>

# This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU General Public License.
#
# See the LICENSE file in the source distribution for further information.

import glob
from sos.report.plugins import Plugin, RedHatPlugin


class AAPreceptorPlugin(Plugin, RedHatPlugin):
    short_desc = 'AAP receptor plugin'
    plugin_name = 'aap_receptor'
    profiles = ('sysmgmt', 'ansible')
    packages = ('receptor', 'receptorctl')
    services = ('receptor',)

    def setup(self):
        self.add_copy_spec([
            "/etc/receptor",
            "/var/lib/receptor",
        ])

        if self.get_option("all_logs"):
            self.add_copy_spec([
                "/var/log/receptor"
            ])
        else:
            self.add_copy_spec([
                "/var/log/receptor/*.log"
            ])

        self.add_forbidden_path([
            "/etc/receptor/tls",
            "/etc/receptor/*key.pem"
        ])

        self.add_cmd_output([
            "ls -llZ /etc/receptor",
            "ls -llZ /var/run/receptor",
            "ls -llZ /var/run/awx-receptor"
        ])

        for s in glob.glob('/var/run/*receptor/*.sock'):
            self.add_cmd_output(f"receptorctl --socket {s} status",
                                suggest_filename="receptorctl_status")
            self.add_cmd_output(f"receptorctl --socket {s} status --json",
                                suggest_filename="receptorctl_status.json")
            break

# vim: set et ts=4 sw=4 :