mirror of
https://github.com/ansible/awx.git
synced 2026-03-24 20:35:02 -02:30
Merge pull request #3815 from pmoravec/awx-pmoravec-tower-sos-plugin-improvements
sosreport plugin improvements Reviewed-by: https://github.com/softwarefactory-project-zuul[bot]
This commit is contained in:
@@ -1,11 +1,9 @@
|
|||||||
# Copyright (c) 2016 Ansible, Inc.
|
# Copyright (c) 2016 Ansible, Inc.
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
|
|
||||||
import sos
|
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin
|
||||||
from distutils.version import LooseVersion
|
|
||||||
|
|
||||||
SOSREPORT_TOWER_COMMANDS = [
|
SOSREPORT_TOWER_COMMANDS = [
|
||||||
"ansible --version", # ansible core version
|
|
||||||
"awx-manage --version", # tower version
|
"awx-manage --version", # tower version
|
||||||
"awx-manage list_instances", # tower cluster configuration
|
"awx-manage list_instances", # tower cluster configuration
|
||||||
"awx-manage run_dispatcher --status", # tower dispatch worker status
|
"awx-manage run_dispatcher --status", # tower dispatch worker status
|
||||||
@@ -23,15 +21,11 @@ SOSREPORT_TOWER_COMMANDS = [
|
|||||||
|
|
||||||
SOSREPORT_TOWER_DIRS = [
|
SOSREPORT_TOWER_DIRS = [
|
||||||
"/etc/tower/",
|
"/etc/tower/",
|
||||||
"/etc/ansible/",
|
|
||||||
"/etc/supervisord.d/",
|
"/etc/supervisord.d/",
|
||||||
"/etc/nginx/",
|
"/etc/nginx/",
|
||||||
"/var/log/tower",
|
"/var/log/tower",
|
||||||
"/var/log/nginx",
|
"/var/log/nginx",
|
||||||
"/var/log/supervisor",
|
"/var/log/supervisor",
|
||||||
"/var/log/syslog",
|
|
||||||
"/var/log/udev",
|
|
||||||
"/var/log/kern*",
|
|
||||||
"/var/log/dist-upgrade",
|
"/var/log/dist-upgrade",
|
||||||
"/var/log/installer",
|
"/var/log/installer",
|
||||||
"/var/log/unattended-upgrades",
|
"/var/log/unattended-upgrades",
|
||||||
@@ -47,38 +41,17 @@ SOSREPORT_FORBIDDEN_PATHS = [
|
|||||||
"/var/log/tower/profile"
|
"/var/log/tower/profile"
|
||||||
]
|
]
|
||||||
|
|
||||||
if LooseVersion(sos.__version__) >= LooseVersion('3.0'):
|
|
||||||
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin
|
|
||||||
|
|
||||||
class tower(Plugin, RedHatPlugin, UbuntuPlugin):
|
class Tower(Plugin, RedHatPlugin, UbuntuPlugin):
|
||||||
'''Collect Ansible Tower related information'''
|
'''Collect Ansible Tower related information'''
|
||||||
plugin_name = "tower"
|
plugin_name = "tower"
|
||||||
|
|
||||||
def setup(self):
|
def setup(self):
|
||||||
|
|
||||||
for path in SOSREPORT_TOWER_DIRS:
|
for path in SOSREPORT_TOWER_DIRS:
|
||||||
self.add_copy_spec(path)
|
self.add_copy_spec(path)
|
||||||
|
|
||||||
for path in SOSREPORT_FORBIDDEN_PATHS:
|
self.add_forbidden_path(SOSREPORT_FORBIDDEN_PATHS)
|
||||||
self.add_forbidden_path(path)
|
|
||||||
|
|
||||||
for command in SOSREPORT_TOWER_COMMANDS:
|
self.add_cmd_output(SOSREPORT_TOWER_COMMANDS)
|
||||||
self.add_cmd_output(command)
|
|
||||||
|
|
||||||
else:
|
|
||||||
import sos.plugintools
|
|
||||||
|
|
||||||
class tower(sos.plugintools.PluginBase):
|
|
||||||
'''Collect Ansible Tower related information'''
|
|
||||||
|
|
||||||
def setup(self):
|
|
||||||
|
|
||||||
for path in SOSREPORT_TOWER_DIRS:
|
|
||||||
self.addCopySpec(path)
|
|
||||||
|
|
||||||
for path in SOSREPORT_FORBIDDEN_PATHS:
|
|
||||||
self.addForbiddenPath(path)
|
|
||||||
|
|
||||||
for command in SOSREPORT_TOWER_COMMANDS:
|
|
||||||
self.collectExtOutput(command)
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user