mirror of
https://github.com/ZwareBear/awx.git
synced 2026-03-20 07:43:35 -05:00
Additional flake8 cleanup
The flake8 command was identifying several warnings and errors. This change addresses the flake8 warnings and updates the setup.cfg with additional exclusions. If accepted, jenkins will be updated to use the flake8 command, rather than using the django_jenkins plugin. This will expedite jenkins testing.
This commit is contained in:
20
Makefile
20
Makefile
@@ -244,14 +244,22 @@ socketservice:
|
|||||||
factcacher:
|
factcacher:
|
||||||
$(PYTHON) manage.py run_fact_cache_receiver
|
$(PYTHON) manage.py run_fact_cache_receiver
|
||||||
|
|
||||||
pep8:
|
reports:
|
||||||
pep8 -r awx/
|
mkdir -p $@
|
||||||
|
|
||||||
pyflakes:
|
pep8: reports
|
||||||
pyflakes awx/
|
@(set -o pipefail && $@ | tee reports/$@.report)
|
||||||
|
|
||||||
check:
|
flake8: reports
|
||||||
flake8
|
@$@ --output-file=reports/$@.report
|
||||||
|
|
||||||
|
pyflakes: reports
|
||||||
|
@(set -o pipefail && $@ | tee reports/$@.report)
|
||||||
|
|
||||||
|
pylint: reports
|
||||||
|
@(set -o pipefail && $@ | reports/$@.report)
|
||||||
|
|
||||||
|
check: flake8 pep8 # pyflakes pylint
|
||||||
|
|
||||||
# Run all API unit tests.
|
# Run all API unit tests.
|
||||||
test:
|
test:
|
||||||
|
|||||||
@@ -36,11 +36,8 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import pwd
|
import pwd
|
||||||
import sys
|
|
||||||
import urllib
|
|
||||||
import urlparse
|
import urlparse
|
||||||
import time
|
import time
|
||||||
from contextlib import closing
|
|
||||||
|
|
||||||
# Requests
|
# Requests
|
||||||
import requests
|
import requests
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import datetime
|
import datetime
|
||||||
import json
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from ansible import constants as C
|
from ansible import constants as C
|
||||||
from ansible.cache.base import BaseCacheModule
|
from ansible.cache.base import BaseCacheModule
|
||||||
|
|||||||
@@ -4,10 +4,10 @@
|
|||||||
# This file is a utility script that is not part of the AWX or Ansible
|
# This file is a utility script that is not part of the AWX or Ansible
|
||||||
# packages. It does not import any code from either package, nor does its
|
# packages. It does not import any code from either package, nor does its
|
||||||
# license apply to Ansible or AWX.
|
# license apply to Ansible or AWX.
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
# modification, are permitted provided that the following conditions are met:
|
# modification, are permitted provided that the following conditions are met:
|
||||||
#
|
#
|
||||||
# Redistributions of source code must retain the above copyright notice, this
|
# Redistributions of source code must retain the above copyright notice, this
|
||||||
# list of conditions and the following disclaimer.
|
# list of conditions and the following disclaimer.
|
||||||
#
|
#
|
||||||
@@ -61,7 +61,7 @@ class TokenAuth(requests.auth.AuthBase):
|
|||||||
return request
|
return request
|
||||||
|
|
||||||
class InventoryScript(object):
|
class InventoryScript(object):
|
||||||
|
|
||||||
def __init__(self, **options):
|
def __init__(self, **options):
|
||||||
self.options = options
|
self.options = options
|
||||||
|
|
||||||
@@ -95,11 +95,11 @@ class InventoryScript(object):
|
|||||||
def run(self):
|
def run(self):
|
||||||
try:
|
try:
|
||||||
self.base_url = self.options.get('base_url', '') or \
|
self.base_url = self.options.get('base_url', '') or \
|
||||||
os.getenv('REST_API_URL', '')
|
os.getenv('REST_API_URL', '')
|
||||||
if not self.base_url:
|
if not self.base_url:
|
||||||
raise ValueError('No REST API URL specified')
|
raise ValueError('No REST API URL specified')
|
||||||
self.auth_token = self.options.get('authtoken', '') or \
|
self.auth_token = self.options.get('authtoken', '') or \
|
||||||
os.getenv('REST_API_TOKEN', '')
|
os.getenv('REST_API_TOKEN', '')
|
||||||
parts = urlparse.urlsplit(self.base_url)
|
parts = urlparse.urlsplit(self.base_url)
|
||||||
if not (parts.username and parts.password) and not self.auth_token:
|
if not (parts.username and parts.password) and not self.auth_token:
|
||||||
raise ValueError('No username/password specified in REST API '
|
raise ValueError('No username/password specified in REST API '
|
||||||
@@ -107,7 +107,7 @@ class InventoryScript(object):
|
|||||||
try:
|
try:
|
||||||
# Command line argument takes precedence over environment
|
# Command line argument takes precedence over environment
|
||||||
# variable.
|
# variable.
|
||||||
self.inventory_id = int(self.options.get('inventory_id', 0) or \
|
self.inventory_id = int(self.options.get('inventory_id', 0) or
|
||||||
os.getenv('INVENTORY_ID', 0))
|
os.getenv('INVENTORY_ID', 0))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise ValueError('Inventory ID must be an integer')
|
raise ValueError('Inventory ID must be an integer')
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class ServiceScanService(BaseService):
|
|||||||
else:
|
else:
|
||||||
pid = None
|
pid = None
|
||||||
else:
|
else:
|
||||||
pid = None
|
pid = None # NOQA
|
||||||
payload = {"name": service_name, "state": service_state, "goal": service_goal, "source": "upstart"}
|
payload = {"name": service_name, "state": service_state, "goal": service_goal, "source": "upstart"}
|
||||||
services.append(payload)
|
services.append(payload)
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ class ServiceScanService(BaseService):
|
|||||||
service_state = "dead"
|
service_state = "dead"
|
||||||
elif len(line_data) == 3:
|
elif len(line_data) == 3:
|
||||||
service_name = line_data[0]
|
service_name = line_data[0]
|
||||||
service_pid = None
|
service_pid = None # NOQA
|
||||||
service_state = "stopped"
|
service_state = "stopped"
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -3,9 +3,7 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import glob
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import tempfile
|
|
||||||
|
|
||||||
MONGO_DB = 'system_tracking'
|
MONGO_DB = 'system_tracking'
|
||||||
|
|
||||||
@@ -119,13 +117,13 @@ ALLOWED_HOSTS = []
|
|||||||
# reverse proxy.
|
# reverse proxy.
|
||||||
REMOTE_HOST_HEADERS = ['REMOTE_ADDR', 'REMOTE_HOST']
|
REMOTE_HOST_HEADERS = ['REMOTE_ADDR', 'REMOTE_HOST']
|
||||||
|
|
||||||
TEMPLATE_CONTEXT_PROCESSORS += (
|
TEMPLATE_CONTEXT_PROCESSORS += ( # NOQA
|
||||||
'django.core.context_processors.request',
|
'django.core.context_processors.request',
|
||||||
'awx.ui.context_processors.settings',
|
'awx.ui.context_processors.settings',
|
||||||
'awx.ui.context_processors.version',
|
'awx.ui.context_processors.version',
|
||||||
)
|
)
|
||||||
|
|
||||||
MIDDLEWARE_CLASSES += (
|
MIDDLEWARE_CLASSES += ( # NOQA
|
||||||
'awx.main.middleware.HAMiddleware',
|
'awx.main.middleware.HAMiddleware',
|
||||||
'awx.main.middleware.ActivityStreamMiddleware',
|
'awx.main.middleware.ActivityStreamMiddleware',
|
||||||
'crum.CurrentRequestUserMiddleware',
|
'crum.CurrentRequestUserMiddleware',
|
||||||
@@ -247,7 +245,7 @@ EMAIL_USE_TLS = False
|
|||||||
# Use Django-Debug-Toolbar if installed.
|
# Use Django-Debug-Toolbar if installed.
|
||||||
try:
|
try:
|
||||||
import debug_toolbar
|
import debug_toolbar
|
||||||
INSTALLED_APPS += ('debug_toolbar',)
|
INSTALLED_APPS += (debug_toolbar.__name__,)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -259,7 +257,7 @@ DEBUG_TOOLBAR_CONFIG = {
|
|||||||
# Use Django-devserver if installed.
|
# Use Django-devserver if installed.
|
||||||
try:
|
try:
|
||||||
import devserver
|
import devserver
|
||||||
INSTALLED_APPS += ('devserver',)
|
INSTALLED_APPS += (devserver.__name__,)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -444,7 +442,7 @@ VMWARE_REGIONS_BLACKLIST = []
|
|||||||
|
|
||||||
# Inventory variable name/values for determining whether a host is
|
# Inventory variable name/values for determining whether a host is
|
||||||
# active in vSphere.
|
# active in vSphere.
|
||||||
VMWARE_ENABLED_VAR = 'vmware_powerState'
|
VMWARE_ENABLED_VAR = 'vmware_powerState'
|
||||||
VMWARE_ENABLED_VALUE = 'poweredOn'
|
VMWARE_ENABLED_VALUE = 'poweredOn'
|
||||||
|
|
||||||
# Inventory variable name containing the unique instance ID.
|
# Inventory variable name containing the unique instance ID.
|
||||||
@@ -609,7 +607,7 @@ LOGGING = {
|
|||||||
'class':'logging.handlers.RotatingFileHandler',
|
'class':'logging.handlers.RotatingFileHandler',
|
||||||
'filters': ['require_debug_false'],
|
'filters': ['require_debug_false'],
|
||||||
'filename': os.path.join(LOG_ROOT, 'tower_warnings.log'),
|
'filename': os.path.join(LOG_ROOT, 'tower_warnings.log'),
|
||||||
'maxBytes': 1024*1024*5, # 5 MB
|
'maxBytes': 1024 * 1024 * 5, # 5 MB
|
||||||
'backupCount': 5,
|
'backupCount': 5,
|
||||||
'formatter':'simple',
|
'formatter':'simple',
|
||||||
},
|
},
|
||||||
@@ -618,7 +616,7 @@ LOGGING = {
|
|||||||
'class':'logging.handlers.RotatingFileHandler',
|
'class':'logging.handlers.RotatingFileHandler',
|
||||||
'filters': ['require_debug_false'],
|
'filters': ['require_debug_false'],
|
||||||
'filename': os.path.join(LOG_ROOT, 'callback_receiver.log'),
|
'filename': os.path.join(LOG_ROOT, 'callback_receiver.log'),
|
||||||
'maxBytes': 1024*1024*5, # 5 MB
|
'maxBytes': 1024 * 1024 * 5, # 5 MB
|
||||||
'backupCount': 5,
|
'backupCount': 5,
|
||||||
'formatter':'simple',
|
'formatter':'simple',
|
||||||
},
|
},
|
||||||
@@ -627,7 +625,7 @@ LOGGING = {
|
|||||||
'class':'logging.handlers.RotatingFileHandler',
|
'class':'logging.handlers.RotatingFileHandler',
|
||||||
'filters': ['require_debug_false'],
|
'filters': ['require_debug_false'],
|
||||||
'filename': os.path.join(LOG_ROOT, 'socketio_service.log'),
|
'filename': os.path.join(LOG_ROOT, 'socketio_service.log'),
|
||||||
'maxBytes': 1024*1024*5, # 5 MB
|
'maxBytes': 1024 * 1024 * 5, # 5 MB
|
||||||
'backupCount': 5,
|
'backupCount': 5,
|
||||||
'formatter':'simple',
|
'formatter':'simple',
|
||||||
},
|
},
|
||||||
@@ -636,7 +634,7 @@ LOGGING = {
|
|||||||
'class':'logging.handlers.RotatingFileHandler',
|
'class':'logging.handlers.RotatingFileHandler',
|
||||||
'filters': ['require_debug_false'],
|
'filters': ['require_debug_false'],
|
||||||
'filename': os.path.join(LOG_ROOT, 'task_system.log'),
|
'filename': os.path.join(LOG_ROOT, 'task_system.log'),
|
||||||
'maxBytes': 1024*1024*5, # 5 MB
|
'maxBytes': 1024 * 1024 * 5, # 5 MB
|
||||||
'backupCount': 5,
|
'backupCount': 5,
|
||||||
'formatter':'simple',
|
'formatter':'simple',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -6,13 +6,12 @@
|
|||||||
# Python
|
# Python
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
import glob
|
|
||||||
|
|
||||||
# Django Split Settings
|
# Django Split Settings
|
||||||
from split_settings.tools import optional, include
|
from split_settings.tools import optional, include
|
||||||
|
|
||||||
# Load default settings.
|
# Load default settings.
|
||||||
from defaults import *
|
from defaults import * # NOQA
|
||||||
|
|
||||||
MONGO_DB = 'system_tracking_dev'
|
MONGO_DB = 'system_tracking_dev'
|
||||||
|
|
||||||
@@ -31,27 +30,24 @@ AWX_PROOT_ENABLED = True
|
|||||||
# Use Django-Jenkins if installed. Only run tests for awx.main app.
|
# Use Django-Jenkins if installed. Only run tests for awx.main app.
|
||||||
try:
|
try:
|
||||||
import django_jenkins
|
import django_jenkins
|
||||||
INSTALLED_APPS += ('django_jenkins',)
|
INSTALLED_APPS += (django_jenkins.__name__,)
|
||||||
PROJECT_APPS = ('awx.main.tests', 'awx.api.tests', 'awx.fact.tests',)
|
PROJECT_APPS = ('awx.main.tests', 'awx.api.tests', 'awx.fact.tests',)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if 'django_jenkins' in INSTALLED_APPS:
|
if 'django_jenkins' in INSTALLED_APPS:
|
||||||
JENKINS_TASKS = (
|
JENKINS_TASKS = (
|
||||||
'django_jenkins.tasks.run_pylint',
|
# 'django_jenkins.tasks.run_pylint',
|
||||||
'django_jenkins.tasks.run_flake8',
|
# 'django_jenkins.tasks.run_flake8',
|
||||||
# The following are not needed when including run_flake8
|
# The following are not needed when including run_flake8
|
||||||
# 'django_jenkins.tasks.run_pep8',
|
# 'django_jenkins.tasks.run_pep8',
|
||||||
# 'django_jenkins.tasks.run_pyflakes',
|
# 'django_jenkins.tasks.run_pyflakes',
|
||||||
# The following are handled by various grunt tasks and no longer required
|
# The following are handled by various grunt tasks and no longer required
|
||||||
# 'django_jenkins.tasks.run_jshint',
|
# 'django_jenkins.tasks.run_jshint',
|
||||||
# 'django_jenkins.tasks.run_csslint',
|
# 'django_jenkins.tasks.run_csslint',
|
||||||
)
|
)
|
||||||
PEP8_RCFILE = "setup.cfg"
|
PEP8_RCFILE = "setup.cfg"
|
||||||
PYLINT_RCFILE = ".pylintrc"
|
PYLINT_RCFILE = ".pylintrc"
|
||||||
CSSLINT_CHECKED_FILES = glob.glob(os.path.join(BASE_DIR, 'ui/static/less/*.less'))
|
|
||||||
JSHINT_CHECKED_FILES = [os.path.join(BASE_DIR, 'ui/static/js'),
|
|
||||||
os.path.join(BASE_DIR, 'ui/static/lib/ansible'),]
|
|
||||||
|
|
||||||
# Much faster than the default
|
# Much faster than the default
|
||||||
# https://docs.djangoproject.com/en/1.6/topics/auth/passwords/#how-django-stores-passwords
|
# https://docs.djangoproject.com/en/1.6/topics/auth/passwords/#how-django-stores-passwords
|
||||||
|
|||||||
@@ -4,10 +4,10 @@
|
|||||||
# Development settings for AWX project, but with DEBUG disabled
|
# Development settings for AWX project, but with DEBUG disabled
|
||||||
|
|
||||||
# Load development settings.
|
# Load development settings.
|
||||||
from defaults import *
|
from defaults import * # NOQA
|
||||||
|
|
||||||
# Load development settings.
|
# Load development settings.
|
||||||
from development import *
|
from development import * # NOQA
|
||||||
|
|
||||||
# Disable capturing DEBUG
|
# Disable capturing DEBUG
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import traceback
|
|||||||
from split_settings.tools import optional, include
|
from split_settings.tools import optional, include
|
||||||
|
|
||||||
# Load default settings.
|
# Load default settings.
|
||||||
from defaults import *
|
from defaults import * # NOQA
|
||||||
|
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
TEMPLATE_DEBUG = DEBUG
|
TEMPLATE_DEBUG = DEBUG
|
||||||
@@ -49,7 +49,7 @@ LOGGING['handlers']['tower_warnings'] = {
|
|||||||
'class':'logging.handlers.RotatingFileHandler',
|
'class':'logging.handlers.RotatingFileHandler',
|
||||||
'filters': ['require_debug_false'],
|
'filters': ['require_debug_false'],
|
||||||
'filename': '/var/log/tower/tower.log',
|
'filename': '/var/log/tower/tower.log',
|
||||||
'maxBytes': 1024*1024*5, # 5 MB
|
'maxBytes': 1024 * 1024 * 5, # 5 MB
|
||||||
'backupCount': 5,
|
'backupCount': 5,
|
||||||
'formatter':'simple',
|
'formatter':'simple',
|
||||||
}
|
}
|
||||||
@@ -60,7 +60,7 @@ LOGGING['handlers']['callback_receiver'] = {
|
|||||||
'class':'logging.handlers.RotatingFileHandler',
|
'class':'logging.handlers.RotatingFileHandler',
|
||||||
'filters': ['require_debug_false'],
|
'filters': ['require_debug_false'],
|
||||||
'filename': '/var/log/tower/callback_receiver.log',
|
'filename': '/var/log/tower/callback_receiver.log',
|
||||||
'maxBytes': 1024*1024*5, # 5 MB
|
'maxBytes': 1024 * 1024 * 5, # 5 MB
|
||||||
'backupCount': 5,
|
'backupCount': 5,
|
||||||
'formatter':'simple',
|
'formatter':'simple',
|
||||||
}
|
}
|
||||||
@@ -70,7 +70,7 @@ LOGGING['handlers']['socketio_service'] = {
|
|||||||
'class':'logging.handlers.RotatingFileHandler',
|
'class':'logging.handlers.RotatingFileHandler',
|
||||||
'filters': ['require_debug_false'],
|
'filters': ['require_debug_false'],
|
||||||
'filename': '/var/log/tower/socketio_service.log',
|
'filename': '/var/log/tower/socketio_service.log',
|
||||||
'maxBytes': 1024*1024*5, # 5 MB
|
'maxBytes': 1024 * 1024 * 5, # 5 MB
|
||||||
'backupCount': 5,
|
'backupCount': 5,
|
||||||
'formatter':'simple',
|
'formatter':'simple',
|
||||||
}
|
}
|
||||||
@@ -80,7 +80,7 @@ LOGGING['handlers']['task_system'] = {
|
|||||||
'class':'logging.handlers.RotatingFileHandler',
|
'class':'logging.handlers.RotatingFileHandler',
|
||||||
'filters': ['require_debug_false'],
|
'filters': ['require_debug_false'],
|
||||||
'filename': '/var/log/tower/task_system.log',
|
'filename': '/var/log/tower/task_system.log',
|
||||||
'maxBytes': 1024*1024*5, # 5 MB
|
'maxBytes': 1024 * 1024 * 5, # 5 MB
|
||||||
'backupCount': 5,
|
'backupCount': 5,
|
||||||
'formatter':'simple',
|
'formatter':'simple',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
from awx.wsgi import application
|
from awx.wsgi import application # NOQA
|
||||||
|
|||||||
@@ -14,8 +14,8 @@
|
|||||||
# W391 - Blank line at end of file
|
# W391 - Blank line at end of file
|
||||||
# W293 - Blank line contains whitespace
|
# W293 - Blank line contains whitespace
|
||||||
ignore=E201,E203,E221,E225,E231,E241,E251,E261,E265,E302,E303,E501,W291,W391,W293
|
ignore=E201,E203,E221,E225,E231,E241,E251,E261,E265,E302,E303,E501,W291,W391,W293
|
||||||
exclude=awx/lib/site-packages,awx/ui,awx/api/urls.py,awx/main/migrations,awx/main/tests/data
|
exclude=.tox,awx/lib/site-packages,awx/plugins/inventory/ec2.py,awx/plugins/inventory/gce.py,awx/plugins/inventory/vmware.py,awx/plugins/inventory/windows_azure.py,awx/plugins/inventory/openstack.py,awx/ui,awx/api/urls.py,awx/main/migrations,awx/main/tests/data
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
ignore=E201,E203,E221,E225,E231,E241,E251,E261,E265,E302,E303,E501,W291,W391,W293,E731
|
ignore=E201,E203,E221,E225,E231,E241,E251,E261,E265,E302,E303,E501,W291,W391,W293,E731
|
||||||
exclude=awx/lib/site-packages,awx/ui,awx/api/urls.py,awx/main/migrations,awx/main/tests/data,node_modules/,awx/projects/
|
exclude=.tox,awx/lib/site-packages,awx/plugins/inventory/ec2.py,awx/plugins/inventory/gce.py,awx/plugins/inventory/vmware.py,awx/plugins/inventory/windows_azure.py,awx/plugins/inventory/openstack.py,awx/ui,awx/api/urls.py,awx/main/migrations,awx/main/tests/data,node_modules/,awx/projects/,tools/docker
|
||||||
|
|||||||
@@ -4,6 +4,33 @@
|
|||||||
import sos
|
import sos
|
||||||
from distutils.version import LooseVersion
|
from distutils.version import LooseVersion
|
||||||
|
|
||||||
|
SOSREPORT_TOWER_COMMANDS = [
|
||||||
|
"ansible --version", # ansible core version
|
||||||
|
"tower-manage --version", # tower version
|
||||||
|
"supervisorctl status", # tower process status
|
||||||
|
"pip list" # pip package list
|
||||||
|
"tree -d /var/lib/awx", # show me the dirs
|
||||||
|
"ls -ll /var/lib/awx", # check permissions
|
||||||
|
"ls -ll /etc/tower",
|
||||||
|
]
|
||||||
|
|
||||||
|
SOSREPORT_TOWER_DIRS = [
|
||||||
|
"/etc/tower/",
|
||||||
|
"/var/log/tower",
|
||||||
|
"/var/log/httpd",
|
||||||
|
"/var/log/apache2",
|
||||||
|
"/var/log/redis",
|
||||||
|
"/var/log/supervisor",
|
||||||
|
"/var/log/syslog",
|
||||||
|
"/var/log/udev",
|
||||||
|
"/var/log/kern*",
|
||||||
|
"/var/log/dist-upgrade",
|
||||||
|
"/var/log/installer",
|
||||||
|
"/var/log/unattended-upgrades",
|
||||||
|
"/var/log/apport.log"
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
if LooseVersion(sos.__version__) >= LooseVersion('3.0'):
|
if LooseVersion(sos.__version__) >= LooseVersion('3.0'):
|
||||||
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin
|
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin
|
||||||
|
|
||||||
@@ -13,36 +40,10 @@ if LooseVersion(sos.__version__) >= LooseVersion('3.0'):
|
|||||||
|
|
||||||
def setup(self):
|
def setup(self):
|
||||||
|
|
||||||
commands = [
|
for path in SOSREPORT_TOWER_DIRS:
|
||||||
"ansible --version", # ansible core version
|
|
||||||
"awx-manage --version", # tower version
|
|
||||||
"supervisorctl status", # tower process status
|
|
||||||
"pip list" # pip package list
|
|
||||||
"tree -d /var/lib/awx", # show me the dirs
|
|
||||||
"ls -ll /var/lib/awx", # check permissions
|
|
||||||
"ls -ll /etc/tower"
|
|
||||||
]
|
|
||||||
|
|
||||||
dirs = [
|
|
||||||
"/etc/tower/",
|
|
||||||
"/var/log/tower",
|
|
||||||
"/var/log/httpd",
|
|
||||||
"/var/log/apache2",
|
|
||||||
"/var/log/redis",
|
|
||||||
"/var/log/supervisor",
|
|
||||||
"/var/log/syslog",
|
|
||||||
"/var/log/udev",
|
|
||||||
"/var/log/kern*",
|
|
||||||
"/var/log/dist-upgrade",
|
|
||||||
"/var/log/installer",
|
|
||||||
"/var/log/unattended-upgrades",
|
|
||||||
"/var/log/apport.log"
|
|
||||||
]
|
|
||||||
|
|
||||||
for path in dirs:
|
|
||||||
self.add_copy_spec(path)
|
self.add_copy_spec(path)
|
||||||
|
|
||||||
for command in commands:
|
for command in SOSREPORT_TOWER_COMMANDS:
|
||||||
self.add_cmd_output(command)
|
self.add_cmd_output(command)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@@ -53,35 +54,9 @@ else:
|
|||||||
|
|
||||||
def setup(self):
|
def setup(self):
|
||||||
|
|
||||||
commands = [
|
for path in SOSREPORT_TOWER_DIRS:
|
||||||
"ansible --version", # ansible core version
|
|
||||||
"awx-manage --version", # tower version
|
|
||||||
"supervisorctl status", # tower process status
|
|
||||||
"pip list" # pip package list
|
|
||||||
"tree -d /var/lib/awx", # show me the dirs
|
|
||||||
"ls -ll /var/lib/awx", # check permissions
|
|
||||||
"ls -ll /etc/tower"
|
|
||||||
]
|
|
||||||
|
|
||||||
dirs = [
|
|
||||||
"/etc/tower/",
|
|
||||||
"/var/log/tower",
|
|
||||||
"/var/log/httpd",
|
|
||||||
"/var/log/apache2",
|
|
||||||
"/var/log/redis",
|
|
||||||
"/var/log/supervisor",
|
|
||||||
"/var/log/syslog",
|
|
||||||
"/var/log/udev",
|
|
||||||
"/var/log/kern*",
|
|
||||||
"/var/log/dist-upgrade",
|
|
||||||
"/var/log/installer",
|
|
||||||
"/var/log/unattended-upgrades",
|
|
||||||
"/var/log/apport.log"
|
|
||||||
]
|
|
||||||
|
|
||||||
for path in dirs:
|
|
||||||
self.addCopySpec(path)
|
self.addCopySpec(path)
|
||||||
|
|
||||||
for command in commands:
|
for command in SOSREPORT_TOWER_COMMANDS:
|
||||||
self.collectExtOutput(command)
|
self.collectExtOutput(command)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user