mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 01:57:35 -03: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:
parent
29822ee140
commit
8909a8a8e4
@ -1,8 +1,7 @@
|
||||
# Copyright (c) 2016 Ansible, Inc.
|
||||
# All Rights Reserved.
|
||||
|
||||
import sos
|
||||
from distutils.version import LooseVersion
|
||||
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin
|
||||
|
||||
SOSREPORT_TOWER_COMMANDS = [
|
||||
"awx-manage --version", # tower version
|
||||
@ -42,36 +41,17 @@ SOSREPORT_FORBIDDEN_PATHS = [
|
||||
"/var/log/tower/profile"
|
||||
]
|
||||
|
||||
if LooseVersion(sos.__version__) >= LooseVersion('3.0'):
|
||||
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin
|
||||
|
||||
class Tower(Plugin, RedHatPlugin, UbuntuPlugin):
|
||||
'''Collect Ansible Tower related information'''
|
||||
plugin_name = "tower"
|
||||
class Tower(Plugin, RedHatPlugin, UbuntuPlugin):
|
||||
'''Collect Ansible Tower related information'''
|
||||
plugin_name = "tower"
|
||||
|
||||
def setup(self):
|
||||
def setup(self):
|
||||
|
||||
for path in SOSREPORT_TOWER_DIRS:
|
||||
self.add_copy_spec(path)
|
||||
for path in SOSREPORT_TOWER_DIRS:
|
||||
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)
|
||||
|
||||
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)
|
||||
self.add_cmd_output(SOSREPORT_TOWER_COMMANDS)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user