mirror of
https://github.com/ansible/awx.git
synced 2026-03-09 05:29:26 -02:30
sosreport plugin to stick on sos >= 3.0 API only
As sosreport 3.0 was released 5 years ago, older sos versions can be ignored / not further supported. Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
This commit is contained in:
@@ -1,8 +1,7 @@
|
|||||||
# 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 = [
|
||||||
"awx-manage --version", # tower version
|
"awx-manage --version", # tower version
|
||||||
@@ -42,36 +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)
|
||||||
|
|
||||||
self.add_forbidden_path(SOSREPORT_FORBIDDEN_PATHS)
|
self.add_forbidden_path(SOSREPORT_FORBIDDEN_PATHS)
|
||||||
|
|
||||||
self.add_cmd_output(SOSREPORT_TOWER_COMMANDS)
|
self.add_cmd_output(SOSREPORT_TOWER_COMMANDS)
|
||||||
|
|
||||||
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