aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2013-04-04 17:06:13 +0100
committerBryn M. Reeves <bmr@redhat.com>2013-04-04 17:06:13 +0100
commit76156e8b7a8b7a31e30038819d0aa0d7ca5de197 (patch)
tree659ad2530a24db86f770ea601469f1d2bf6241e7
parenta567c0a6fb7b6956e5f62cca9421f6b52bab8a39 (diff)
parent29e180fbc291686ee991952005c84c4b0d216a86 (diff)
downloadsos-76156e8b7a8b7a31e30038819d0aa0d7ca5de197.tar.gz
Merge branch 'bmr-pep8ify-names'
Conflicts: sos/plugins/general.py sos/plugins/juju.py
-rwxr-xr-xexample_plugins/example.py12
-rw-r--r--sos/plugins/__init__.py236
-rw-r--r--sos/plugins/abrt.py14
-rw-r--r--sos/plugins/acpid.py4
-rw-r--r--sos/plugins/amd.py6
-rw-r--r--sos/plugins/anaconda.py4
-rw-r--r--sos/plugins/apache.py16
-rw-r--r--sos/plugins/apparmor.py2
-rw-r--r--sos/plugins/apport.py2
-rw-r--r--sos/plugins/as7.py46
-rw-r--r--sos/plugins/auditd.py6
-rw-r--r--sos/plugins/autofs.py20
-rw-r--r--sos/plugins/azure.py2
-rw-r--r--sos/plugins/bootloader.py6
-rw-r--r--sos/plugins/ceph.py18
-rw-r--r--sos/plugins/cgroups.py4
-rw-r--r--sos/plugins/cloudforms.py8
-rw-r--r--sos/plugins/cluster.py126
-rw-r--r--sos/plugins/cobbler.py14
-rw-r--r--sos/plugins/corosync.py18
-rw-r--r--sos/plugins/crontab.py6
-rw-r--r--sos/plugins/cs.py24
-rw-r--r--sos/plugins/devicemapper.py52
-rw-r--r--sos/plugins/dhcp.py4
-rw-r--r--sos/plugins/dovecot.py4
-rw-r--r--sos/plugins/dpkg.py4
-rw-r--r--sos/plugins/ds.py10
-rw-r--r--sos/plugins/emc.py168
-rw-r--r--sos/plugins/filesys.py32
-rw-r--r--sos/plugins/ftp.py4
-rw-r--r--sos/plugins/gdm.py2
-rw-r--r--sos/plugins/general.py52
-rw-r--r--sos/plugins/gluster.py32
-rw-r--r--sos/plugins/hardware.py30
-rw-r--r--sos/plugins/hts.py4
-rw-r--r--sos/plugins/i18n.py4
-rw-r--r--sos/plugins/infiniband.py16
-rw-r--r--sos/plugins/initrd.py4
-rw-r--r--sos/plugins/ipa.py48
-rw-r--r--sos/plugins/ipsec.py4
-rw-r--r--sos/plugins/iscsi.py10
-rw-r--r--sos/plugins/iscsitarget.py6
-rw-r--r--sos/plugins/jboss.py104
-rw-r--r--sos/plugins/juju.py2
-rw-r--r--sos/plugins/kdump.py6
-rw-r--r--sos/plugins/kernel.py24
-rw-r--r--sos/plugins/kernelrt.py16
-rw-r--r--sos/plugins/kvm.py18
-rw-r--r--sos/plugins/ldap.py8
-rw-r--r--sos/plugins/libraries.py10
-rw-r--r--sos/plugins/libvirt.py4
-rw-r--r--sos/plugins/logrotate.py4
-rw-r--r--sos/plugins/lsbrelease.py6
-rw-r--r--sos/plugins/maas.py6
-rw-r--r--sos/plugins/memory.py8
-rw-r--r--sos/plugins/mrggrid.py4
-rw-r--r--sos/plugins/mrgmessg.py2
-rw-r--r--sos/plugins/mysql.py2
-rw-r--r--sos/plugins/named.py30
-rw-r--r--sos/plugins/netdump.py2
-rw-r--r--sos/plugins/networking.py92
-rw-r--r--sos/plugins/nfsserver.py10
-rw-r--r--sos/plugins/nis.py4
-rw-r--r--sos/plugins/nscd.py10
-rw-r--r--sos/plugins/ntp.py4
-rw-r--r--sos/plugins/oddjob.py6
-rw-r--r--sos/plugins/openssl.py4
-rw-r--r--sos/plugins/openstack.py42
-rw-r--r--sos/plugins/openswan.py6
-rw-r--r--sos/plugins/pam.py6
-rw-r--r--sos/plugins/postfix.py4
-rw-r--r--sos/plugins/postgresql.py32
-rw-r--r--sos/plugins/ppp.py4
-rw-r--r--sos/plugins/printing.py12
-rw-r--r--sos/plugins/process.py10
-rw-r--r--sos/plugins/psacct.py8
-rw-r--r--sos/plugins/pxe.py10
-rw-r--r--sos/plugins/qpidd.py20
-rw-r--r--sos/plugins/quagga.py2
-rw-r--r--sos/plugins/radius.py6
-rw-r--r--sos/plugins/rhevm.py12
-rw-r--r--sos/plugins/rhn.py42
-rw-r--r--sos/plugins/rhui.py8
-rw-r--r--sos/plugins/rpm.py12
-rw-r--r--sos/plugins/s390.py32
-rw-r--r--sos/plugins/samba.py8
-rw-r--r--sos/plugins/sanlock.py10
-rw-r--r--sos/plugins/sar.py10
-rw-r--r--sos/plugins/selinux.py28
-rw-r--r--sos/plugins/sendmail.py2
-rw-r--r--sos/plugins/smartcard.py8
-rw-r--r--sos/plugins/snmp.py2
-rw-r--r--sos/plugins/soundcard.py14
-rw-r--r--sos/plugins/squid.py2
-rw-r--r--sos/plugins/ssh.py2
-rw-r--r--sos/plugins/sssd.py4
-rw-r--r--sos/plugins/startup.py12
-rw-r--r--sos/plugins/sunrpc.py12
-rw-r--r--sos/plugins/system.py16
-rw-r--r--sos/plugins/systemd.py30
-rw-r--r--sos/plugins/systemtap.py4
-rw-r--r--sos/plugins/sysvipc.py4
-rw-r--r--sos/plugins/tftpserver.py2
-rw-r--r--sos/plugins/tomcat.py2
-rw-r--r--sos/plugins/udev.py2
-rw-r--r--sos/plugins/veritas.py14
-rw-r--r--sos/plugins/vmware.py4
-rw-r--r--sos/plugins/x11.py6
-rw-r--r--sos/plugins/xen.py46
-rw-r--r--sos/plugins/xinetd.py4
-rw-r--r--sos/plugins/yum.py30
-rw-r--r--sos/policies/__init__.py110
-rw-r--r--sos/policies/debian.py4
-rw-r--r--sos/policies/redhat.py28
-rw-r--r--sos/policies/windows.py2
-rw-r--r--sos/sosreport.py46
-rw-r--r--sos/utilities.py6
-rw-r--r--tests/option_tests.py12
-rw-r--r--tests/plugin_tests.py70
-rw-r--r--tests/policy_tests.py8
-rw-r--r--tests/utilities_tests.py6
121 files changed, 1154 insertions, 1154 deletions
diff --git a/example_plugins/example.py b/example_plugins/example.py
index 4b49e423..e13d92b5 100755
--- a/example_plugins/example.py
+++ b/example_plugins/example.py
@@ -20,7 +20,7 @@ from sos.plugins import Plugin, RedHatPlugin
class example(Plugin, RedHatPlugin):
'''This is the description for the example plugin'''
# Plugin developers want to override setup() from which they will call
- # addCopySpec() to collect files and collectExtOutput() to collect programs
+ # add_copy_spec() to collect files and collectExtOutput() to collect programs
# output.
# Add your options here, indicate whether they are slow to run, and set
@@ -28,7 +28,7 @@ class example(Plugin, RedHatPlugin):
# each option is a tuple of the following format:
# (name, description, fast or slow, default value)
# each option will be addressable like -k name=value
- optionList = [("init.d", 'Gathers the init.d directory', 'slow', 0),
+ option_list = [("init.d", 'Gathers the init.d directory', 'slow', 0),
('follicles', 'Gathers information about each follicle on every toe', 'slow', 0),
('color', 'Gathers toenail polish color', 'fast', 0)]
@@ -41,16 +41,16 @@ class example(Plugin, RedHatPlugin):
are provided to the output from each command.
'''
# Here's how to copy files and directory trees
- self.addCopySpec("/etc/hosts")
+ self.add_copy_spec("/etc/hosts")
with open("/proc/cpuinfo") as f:
for line in f:
if "vendor_id" in line:
- self.addAlert("Vendor ID string is: %s <br>\n" % line)
+ self.add_alert("Vendor ID string is: %s <br>\n" % line)
# Here's how to test your options and execute if enabled
- if self.isOptionEnabled("init.d"):
- self.addCopySpec("/etc/init.d") # copies a whole directory tree
+ if self.option_enabled("init.d"):
+ self.add_copy_spec("/etc/init.d") # copies a whole directory tree
# Here's how to execute a command
self.collectExtOutput("/bin/ps -ef")
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
index 95a1ea16..6df08fc9 100644
--- a/sos/plugins/__init__.py
+++ b/sos/plugins/__init__.py
@@ -25,7 +25,7 @@
# pylint: disable-msg = W0613
from __future__ import with_statement
-from sos.utilities import sosGetCommandOutput, import_module, grep, fileobj, tail
+from sos.utilities import sos_get_command_output, import_module, grep, fileobj, tail
from sos import _sos as _
import inspect
import os
@@ -47,26 +47,26 @@ try:
except ImportError:
import simplejson as json
-def commonPrefix(l1, l2, common = None):
+def common_prefix(l1, l2, common = None):
"""Returns a tuple like the following:
([common, elements, from l1, and l2], [[tails, from, l1], [tails, from, l2]])
- >>> commonPrefix(['usr','share','foo'], ['usr','share','bar'])
+ >>> common_prefix(['usr','share','foo'], ['usr','share','bar'])
(['usr','share'], [['foo'], ['bar']])
"""
if common is None:
common = []
if len(l1) < 1 or len(l2) < 1 or l1[0] != l2[0]:
return (common, [l1, l2])
- return commonPrefix(l1[1:], l2[1:], common+[l1[0]])
+ return common_prefix(l1[1:], l2[1:], common+[l1[0]])
-def sosRelPath(path1, path2, sep=os.path.sep, pardir=os.path.pardir):
+def sos_relative_path(path1, path2, sep=os.path.sep, pardir=os.path.pardir):
'''Return a relative path from path1 equivalent to path path2. In
particular: the empty string, if path1 == path2; path2, if path1 and path2
have no common prefix.
'''
try:
- common, (u1, u2) = commonPrefix(path1.split(sep), path2.split(sep))
+ common, (u1, u2) = common_prefix(path1.split(sep), path2.split(sep))
except AttributeError:
return path2
@@ -112,7 +112,7 @@ class Plugin(object):
packages (files) is an iterable of the names of packages (the paths
of files) to check for before running this plugin. If any of these packages
- or files is found on the system, the default implementation of checkenabled
+ or files is found on the system, the default implementation of check_enabled
will return True.
"""
@@ -123,30 +123,30 @@ class Plugin(object):
files = ()
def __init__(self, commons):
- if not getattr(self, "optionList", False):
- self.optionList = []
+ if not getattr(self, "option_list", False):
+ self.option_list = []
- self.copiedFiles = []
- self.executedCommands = []
+ self.copied_files = []
+ self.executed_commands = []
self.alerts = []
- self.customText = ""
- self.optNames = []
- self.optParms = []
- self.cInfo = commons
- self.forbiddenPaths = []
- self.copyPaths = []
- self.copyStrings = []
- self.collectProgs = []
+ self.custom_text = ""
+ self.opt_names = []
+ self.opt_parms = []
+ self.commons = commons
+ self.forbidden_paths = []
+ self.copy_paths = []
+ self.copy_strings = []
+ self.collect_cmds = []
self.must_exit = False
- self.soslog = self.cInfo['soslog']
- self.proflog = self.cInfo['proflog']
+ self.soslog = self.commons['soslog']
+ self.proflog = self.commons['proflog']
# get the option list into a dictionary
- for opt in self.optionList:
- self.optNames.append(opt[0])
- self.optParms.append({'desc':opt[1], 'speed':opt[2], 'enabled':opt[3]})
+ for opt in self.option_list:
+ self.opt_names.append(opt[0])
+ self.opt_parms.append({'desc':opt[1], 'speed':opt[2], 'enabled':opt[3]})
@classmethod
def name(class_):
@@ -158,13 +158,13 @@ class Plugin(object):
return class_.__name__.lower()
def policy(self):
- return self.cInfo["policy"]
+ return self.commons["policy"]
- def isInstalled(self, package_name):
+ def is_installed(self, package_name):
'''Is the package $package_name installed?'''
- return (self.policy().pkgByName(package_name) is not None)
+ return (self.policy().pkg_by_name(package_name) is not None)
- def doCmdOutputSub(self, cmd, regexp, subst):
+ def do_cmd_output_sub(self, cmd, regexp, subst):
'''Apply a regexp substitution to command output archived by sosreport.
cmd is the command name from which output is collected (i.e. excluding
parameters). The regexp can be a string or a compiled re object. The
@@ -175,16 +175,16 @@ class Plugin(object):
This function returns the number of replacements made.
'''
- if self.cInfo['cmdlineopts'].profiler:
+ if self.commons['cmdlineopts'].profiler:
start_time = time()
globstr = '*' + cmd + '*'
self.soslog.debug("substituting '%s' for '%s' in commands matching %s"
% (subst, regexp, globstr))
try:
- for called in self.executedCommands:
+ for called in self.executed_commands:
if fnmatch.fnmatch(called['exe'], globstr):
- path = os.path.join(self.cInfo['cmddir'], called['file'])
+ path = os.path.join(self.commons['cmddir'], called['file'])
self.soslog.debug("applying substitution to %s" % path)
readable = self.archive.open_file(path)
result, replacements = re.subn(
@@ -197,13 +197,13 @@ class Plugin(object):
msg = 'regex substitution failed for %s in plugin %s with: "%s"'
self.soslog.error(msg % (path, self.name(), e))
replacements = 0
- if self.cInfo['cmdlineopts'].profiler:
+ if self.commons['cmdlineopts'].profiler:
time_passed = time() - start_time
self.proflog.debug("subst: %-75s time: %f"
% (globstr, time_passed))
return replacements
- def doFileSub(self, srcpath, regexp, subst):
+ def do_file_sub(self, srcpath, regexp, subst):
'''Apply a regexp substitution to a file archived by sosreport.
srcpath is the path in the archive where the file can be found. regexp
can be a regexp string or a compiled re object. subst is a string to
@@ -211,7 +211,7 @@ class Plugin(object):
This function returns the number of replacements made.
'''
- if self.cInfo['cmdlineopts'].profiler:
+ if self.commons['cmdlineopts'].profiler:
start_time = time()
try:
@@ -230,13 +230,13 @@ class Plugin(object):
msg = 'regex substitution failed for %s in plugin %s with: "%s"'
self.soslog.error(msg % (path, self.name(), e))
replacements = 0
- if self.cInfo['cmdlineopts'].profiler:
+ if self.commons['cmdlineopts'].profiler:
time_passed = time() - start_time
self.proflog.debug("subst : %-75s time: %f"
% (srcpath, time_passed))
return replacements
- def doRegexFindAll(self, regex, fname):
+ def do_regex_find_all(self, regex, fname):
return regex_findall(regex, fname)
def _path_in_path_list(self, path, path_list):
@@ -277,12 +277,12 @@ class Plugin(object):
self.archive.add_link(reldest,srcpath)
# copy the symlink target translating relative targets
- # to absolute paths to pass to doCopyFileOrDir.
+ # to absolute paths to pass to do_copy_file_or_dir.
self.soslog.debug("normalized link target %s as %s"
%(linkdest, absdest))
- self.doCopyFileOrDir(absdest)
+ self.do_copy_file_or_dir(absdest)
- self.copiedFiles.append({
+ self.copied_files.append({
'srcpath':srcpath,
'dstpath':srcpath,
'symlink':"yes",
@@ -290,16 +290,16 @@ class Plugin(object):
def copy_dir(self, srcpath, sub=None):
for afile in os.listdir(srcpath):
- self.doCopyFileOrDir(os.path.join(srcpath, afile), dest=None, sub=sub)
+ self.do_copy_file_or_dir(os.path.join(srcpath, afile), dest=None, sub=sub)
def _get_dest_for_srcpath(self, srcpath):
- for copied in self.copiedFiles:
+ for copied in self.copied_files:
if srcpath == copied["srcpath"]:
return copied["dstpath"]
return None
# Methods for copying files and shelling out
- def doCopyFileOrDir(self, srcpath, dest=None, sub=None):
+ def do_copy_file_or_dir(self, srcpath, dest=None, sub=None):
# pylint: disable-msg = R0912
# pylint: disable-msg = R0915
'''Copy file or directory to the destination tree. If a directory, then
@@ -311,10 +311,10 @@ class Plugin(object):
/configurations/my_file.conf.
'''
- if self.cInfo['cmdlineopts'].profiler:
+ if self.commons['cmdlineopts'].profiler:
start_time = time()
- if self._path_in_path_list(srcpath, self.forbiddenPaths):
+ if self._path_in_path_list(srcpath, self.forbidden_paths):
self.soslog.debug("%s is in the forbidden path list" % srcpath)
return ''
@@ -349,12 +349,12 @@ class Plugin(object):
else:
self.archive.add_file(srcpath, dest)
- self.copiedFiles.append({
+ self.copied_files.append({
'srcpath':srcpath,
'dstpath':dest,
'symlink':"no"})
- if self.cInfo['cmdlineopts'].profiler:
+ if self.commons['cmdlineopts'].profiler:
time_passed = time() - start_time
self.proflog.debug("copied: %-75s time: %f" % (srcpath, time_passed))
except Exception, e:
@@ -362,32 +362,32 @@ class Plugin(object):
self.soslog.error(traceback.format_exc())
- def addForbiddenPath(self, forbiddenPath):
- """Specify a path to not copy, even if it's part of a copyPaths[]
+ def add_forbidden_path(self, forbiddenPath):
+ """Specify a path to not copy, even if it's part of a copy_paths[]
entry.
"""
# Glob case handling is such that a valid non-glob is a reduced glob
for filespec in glob.glob(forbiddenPath):
- self.forbiddenPaths.append(filespec)
+ self.forbidden_paths.append(filespec)
- def getAllOptions(self):
+ def get_all_options(self):
"""return a list of all options selected"""
- return (self.optNames, self.optParms)
+ return (self.opt_names, self.opt_parms)
- def setOption(self, optionname, value):
+ def set_option(self, optionname, value):
'''set the named option to value.'''
- for name, parms in izip(self.optNames, self.optParms):
+ for name, parms in izip(self.opt_names, self.opt_parms):
if name == optionname:
parms['enabled'] = value
return True
else:
return False
- def isOptionEnabled(self, optionname):
- '''Deprecated, use getOption() instead'''
- return self.getOption(optionname)
+ def option_enabled(self, optionname):
+ '''Deprecated, use get_option() instead'''
+ return self.get_option(optionname)
- def getOption(self, optionname, default=0):
+ def get_option(self, optionname, default=0):
"""Returns the first value that matches 'optionname' in parameters
passed in via the command line or set via set_option or via the
global_plugin_options dictionary, in that order.
@@ -402,30 +402,30 @@ class Plugin(object):
else:
return key == optionname
- for name, parms in izip(self.optNames, self.optParms):
+ for name, parms in izip(self.opt_names, self.opt_parms):
if _check(name):
val = parms['enabled']
if val != None:
return val
- for key, value in self.cInfo.get('global_plugin_options', {}).iteritems():
+ for key, value in self.commons.get('global_plugin_options', {}).iteritems():
if _check(key):
return value
return default
- def getOptionAsList(self, optionname, delimiter=",", default=None):
+ def get_option_as_list(self, optionname, delimiter=",", default=None):
'''Will try to return the option as a list separated by the
delimiter.
'''
- option = self.getOption(optionname)
+ option = self.get_option(optionname)
try:
opt_list = [opt.strip() for opt in option.split(delimiter)]
return filter(None, opt_list)
except Exception:
return default
- def addCopySpecLimit(self, fname, sizelimit=None, sub=None):
+ def add_copy_spec_limit(self, fname, sizelimit=None, sub=None):
"""Add a file or glob but limit it to sizelimit megabytes. If fname is
a single file the file will be tailed to meet sizelimit. If the first
file in a glob is too large it will be tailed to meet the sizelimit.
@@ -447,7 +447,7 @@ class Plugin(object):
if sizelimit and cursize > sizelimit:
limit_reached = True
break
- self.addCopySpec(flog, sub)
+ self.add_copy_spec(flog, sub)
if flog == files[0] and limit_reached:
flog_name = flog
@@ -456,17 +456,17 @@ class Plugin(object):
old, new = sub
flog_name = flog.replace(old, new)
strfile = flog_name.replace(os.path.sep, ".") + ".tailed"
- self.addStringAsFile(tail(flog, sizelimit), strfile)
+ self.add_string_as_file(tail(flog, sizelimit), strfile)
self.archive.add_link(os.path.join(
os.path.relpath('/', os.path.dirname(flog)), 'sos_strings',
self.name(), strfile), flog)
- def addCopySpecs(self, copyspecs, sub=None):
+ def add_copy_specs(self, copyspecs, sub=None):
for copyspec in copyspecs:
- self.addCopySpec(copyspec, sub)
+ self.add_copy_spec(copyspec, sub)
- def addCopySpec(self, copyspec, sub=None):
+ def add_copy_spec(self, copyspec, sub=None):
"""Add a file specification (can be file, dir,or shell glob) to be
copied into the sosreport by this module.
"""
@@ -475,43 +475,43 @@ class Plugin(object):
return False
# Glob case handling is such that a valid non-glob is a reduced glob
for filespec in glob.glob(copyspec):
- if filespec not in self.copyPaths:
- self.copyPaths.append((filespec, sub))
+ if filespec not in self.copy_paths:
+ self.copy_paths.append((filespec, sub))
- def callExtProg(self, prog, timeout=300):
+ def call_ext_prog(self, prog, timeout=300):
"""Execute a command independantly of the output gathering part of
sosreport.
"""
# pylint: disable-msg = W0612
- return sosGetCommandOutput(prog, timeout)
+ return sos_get_command_output(prog, timeout)
- def checkExtprog(self, prog):
+ def check_ext_prog(self, prog):
"""Execute a command independently of the output gathering part of
sosreport and check the return code. Return True for a return code of 0
and False otherwise.
"""
- (status, output, runtime) = self.callExtProg(prog)
+ (status, output, runtime) = self.call_ext_prog(prog)
return (status == 0)
- def addCmdOutput(self, exe, suggest_filename=None, root_symlink=None, timeout=300):
+ def add_cmd_output(self, exe, suggest_filename=None, root_symlink=None, timeout=300):
"""Run a program and collect the output"""
- self.collectProgs.append( (exe, suggest_filename, root_symlink, timeout) )
+ self.collect_cmds.append( (exe, suggest_filename, root_symlink, timeout) )
- def fileGrep(self, regexp, *fnames):
+ def file_grep(self, regexp, *fnames):
"""Returns lines matched in fnames, where fnames can either be
pathnames to files to grep through or open file objects to grep through
line by line.
"""
return grep(regexp, *fnames)
- def mangleCommand(self, exe):
+ def mangle_command(self, exe):
return mangle_command(exe)
- def makeCommandFilename(self, exe):
+ def make_command_filename(self, exe):
"""The internal function to build up a filename based on a command."""
- outfn = os.path.join(self.cInfo['cmddir'], self.name(), self.mangleCommand(exe))
+ outfn = os.path.join(self.commons['cmddir'], self.name(), self.mangle_command(exe))
# check for collisions
if os.path.exists(outfn):
@@ -525,62 +525,62 @@ class Plugin(object):
return outfn
- def addStringAsFile(self, content, filename):
+ def add_string_as_file(self, content, filename):
"""Add a string to the archive as a file named `filename`"""
- self.copyStrings.append((content, filename))
+ self.copy_strings.append((content, filename))
- def getCmdOutputNow(self, exe, suggest_filename=None, root_symlink=False, timeout=300):
+ def get_cmd_output_now(self, exe, suggest_filename=None, root_symlink=False, timeout=300):
"""Execute a command and save the output to a file for inclusion in the
report.
"""
- if self.cInfo['cmdlineopts'].profiler:
+ if self.commons['cmdlineopts'].profiler:
start_time = time()
# pylint: disable-msg = W0612
- status, shout, runtime = sosGetCommandOutput(exe, timeout=timeout)
+ status, shout, runtime = sos_get_command_output(exe, timeout=timeout)
if (status == 127):
self.soslog.info("could not run '%s': command not found" % exe)
return None
if suggest_filename:
- outfn = self.makeCommandFilename(suggest_filename)
+ outfn = self.make_command_filename(suggest_filename)
else:
- outfn = self.makeCommandFilename(exe)
+ outfn = self.make_command_filename(exe)
- outfn_strip = outfn[len(self.cInfo['cmddir'])+1:]
+ outfn_strip = outfn[len(self.commons['cmddir'])+1:]
self.archive.add_string(shout, outfn)
if root_symlink:
self.archive.add_link(outfn, root_symlink)
# save info for later
- self.executedCommands.append({'exe': exe, 'file':outfn_strip}) # save in our list
- self.cInfo['xmlreport'].add_command(cmdline=exe,exitcode=status,f_stdout=outfn_strip,runtime=runtime)
+ self.executed_commands.append({'exe': exe, 'file':outfn_strip}) # save in our list
+ self.commons['xmlreport'].add_command(cmdline=exe,exitcode=status,f_stdout=outfn_strip,runtime=runtime)
- if self.cInfo['cmdlineopts'].profiler:
+ if self.commons['cmdlineopts'].profiler:
time_passed = time() - start_time
self.proflog.debug("output: %-75s time: %f" % (exe, time_passed))
return outfn
# For adding output
- def addAlert(self, alertstring):
+ def add_alert(self, alertstring):
"""Add an alert to the collection of alerts for this plugin. These
will be displayed in the report
"""
self.alerts.append(alertstring)
- def addCustomText(self, text):
+ def add_custom_text(self, text):
"""Append text to the custom text that is included in the report. This
is freeform and can include html.
"""
- self.customText += text
+ self.custom_text += text
- def copyStuff(self):
+ def collect(self):
"""Collect the data for a plugin."""
- for path, sub in self.copyPaths:
- self.doCopyFileOrDir(path, sub=sub)
+ for path, sub in self.copy_paths:
+ self.do_copy_file_or_dir(path, sub=sub)
- for string, file_name in self.copyStrings:
+ for string, file_name in self.copy_strings:
try:
self.archive.add_string(string,
os.path.join('sos_strings', self.name(), file_name))
@@ -588,11 +588,11 @@ class Plugin(object):
self.soslog.debug("could not create %s, traceback follows: %s"
% (file_name, e))
- for progs in izip(self.collectProgs):
+ for progs in izip(self.collect_cmds):
prog, suggest_filename, root_symlink, timeout = progs[0]
self.soslog.debug("collecting output of '%s'" % prog)
try:
- self.getCmdOutputNow(prog, suggest_filename,
+ self.get_cmd_output_now(prog, suggest_filename,
root_symlink, timeout)
except Exception, e:
self.soslog.debug("error collecting output of '%s' (%s)"
@@ -609,7 +609,7 @@ class Plugin(object):
except:
return "<no description available>"
- def checkenabled(self):
+ def check_enabled(self):
"""This method will be used to verify that a plugin should execute
given the condition of the underlying environment. The default
implementation will return True if neither class.files or
@@ -627,16 +627,16 @@ class Plugin(object):
self.packages = [self.packages]
return (any(os.path.exists(fname) for fname in self.files) or
- any(self.isInstalled(pkg) for pkg in self.packages))
+ any(self.is_installed(pkg) for pkg in self.packages))
return True
- def defaultenabled(self):
+ def default_enabled(self):
"""This devices whether a plugin should be automatically loaded or
only if manually specified in the command line."""
return True
def setup(self):
- """This method must be overridden to add the copyPaths, forbiddenPaths,
+ """This method must be overridden to add the copy_paths, forbidden_paths,
and external programs to be collected at a minimum.
"""
pass
@@ -658,9 +658,9 @@ class Plugin(object):
html = html + "<h2> Plugin <em>" + self.name() + "</em></h2>\n"
# Files
- if len(self.copiedFiles):
+ if len(self.copied_files):
html = html + "<p>Files copied:<br><ul>\n"
- for afile in self.copiedFiles:
+ for afile in self.copied_files:
html = html + '<li><a href="%s">%s</a>' % \
(".." + afile['dstpath'], afile['srcpath'])
if (afile['symlink'] == "yes"):
@@ -669,13 +669,13 @@ class Plugin(object):
html = html + "</ul></p>\n"
# Command Output
- if len(self.executedCommands):
+ if len(self.executed_commands):
html = html + "<p>Commands Executed:<br><ul>\n"
# convert file name to relative path from our root
# don't use relpath - these are HTML paths not OS paths.
- for cmd in self.executedCommands:
+ for cmd in self.executed_commands:
if cmd["file"] and len(cmd["file"]):
- cmdOutRelPath = "../" + self.cInfo['cmddir'] \
+ cmdOutRelPath = "../" + self.commons['cmddir'] \
+ "/" + cmd['file']
html = html + '<li><a href="%s">%s</a></li>\n' % \
(cmdOutRelPath, cmd['exe'])
@@ -691,9 +691,9 @@ class Plugin(object):
html = html + "</ul></p>\n"
# Custom Text
- if (self.customText != ""):
+ if (self.custom_text != ""):
html = html + "<p>Additional Information:<br>\n"
- html = html + self.customText + "</p>\n"
+ html = html + self.custom_text + "</p>\n"
return html
@@ -747,21 +747,21 @@ class AS7Mixin(object):
try:
return self.query_java(request_obj)
except Exception, e:
- self.addAlert("JBOSS API call failed, falling back to HTTP: %s" % e)
+ self.add_alert("JBOSS API call failed, falling back to HTTP: %s" % e)
return self.query_http(request_obj)
def _get_opt(self, first, second, default=None):
- val = self.getOption(first)
+ val = self.get_option(first)
if val:
return val
- val = self.getOption(second)
+ val = self.get_option(second)
if val:
return val
return default
def query_java(self, request_obj):
from org.jboss.dmr import ModelNode
- controller_client = self.getOption('controller_client_proxy')
+ controller_client = self.get_option('controller_client_proxy')
if not controller_client:
raise AttributeError("Controller Client is not available")
@@ -820,7 +820,7 @@ class AS7Mixin(object):
return resp.read()
except Exception, e:
err_msg = "Could not query url: %s; error: %s" % (uri, e)
- self.addAlert(err_msg)
+ self.add_alert(err_msg)
return err_msg
def set_domain_info(self, parameters=None):
@@ -828,8 +828,8 @@ class AS7Mixin(object):
if it is present to the desired resource. This is to support
domain-mode operation in AS7.
"""
- host_controller_name = self.getOption("as7_host_controller_name")
- server_name = self.getOption("as7_server_name")
+ host_controller_name = self.get_option("as7_host_controller_name")
+ server_name = self.get_option("as7_server_name")
if host_controller_name and server_name:
if not parameters:
@@ -847,7 +847,7 @@ class AS7Mixin(object):
r = self.Request(resource=resource,
parameters=parameters,
operation=operation)
- self.addStringAsFile(self.query(r), filename=outfile)
+ self.add_string_as_file(self.query(r), filename=outfile)
def import_plugin(name, superclasses=None):
diff --git a/sos/plugins/abrt.py b/sos/plugins/abrt.py
index 8eff9628..ce5c7c10 100644
--- a/sos/plugins/abrt.py
+++ b/sos/plugins/abrt.py
@@ -21,23 +21,23 @@ class abrt(Plugin, RedHatPlugin):
"""ABRT log dump
"""
- optionList = [("backtraces", 'collect backtraces for every report', 'slow', False)]
+ option_list = [("backtraces", 'collect backtraces for every report', 'slow', False)]
- def checkenabled(self):
- return self.isInstalled("abrt-cli") or \
+ def check_enabled(self):
+ return self.is_installed("abrt-cli") or \
exists("/var/spool/abrt")
def do_backtraces(self):
- ret, output, rtime = self.callExtProg('/usr/bin/sqlite3 /var/spool/abrt/abrt-db \'select UUID from abrt_v4\'')
+ ret, output, rtime = self.call_ext_prog('/usr/bin/sqlite3 /var/spool/abrt/abrt-db \'select UUID from abrt_v4\'')
try:
for uuid in output.split():
- self.addCmdOutput("/usr/bin/abrt-cli -ib %s" % uuid,
+ self.add_cmd_output("/usr/bin/abrt-cli -ib %s" % uuid,
suggest_filename=("backtrace_%s" % uuid))
except IndexError:
pass
def setup(self):
- self.addCmdOutput("/usr/bin/abrt-cli -lf",
+ self.add_cmd_output("/usr/bin/abrt-cli -lf",
suggest_filename="abrt-log")
- if self.getOption('backtraces'):
+ if self.get_option('backtraces'):
self.do_backtraces()
diff --git a/sos/plugins/acpid.py b/sos/plugins/acpid.py
index 1c092e42..c49da2d3 100644
--- a/sos/plugins/acpid.py
+++ b/sos/plugins/acpid.py
@@ -21,7 +21,7 @@ class RedHatAcpid(acpid, RedHatPlugin):
"""acpid related information
"""
def setup(self):
- self.addCopySpecs([
+ self.add_copy_specs([
"/var/log/acpid*",
"/etc/acpi/events/power.conf"])
@@ -29,5 +29,5 @@ class DebianAcpid(acpid, DebianPlugin, UbuntuPlugin):
"""acpid related information for Debian and Ubuntu
"""
def setup(self):
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/acpi/events/powerbtn*"])
diff --git a/sos/plugins/amd.py b/sos/plugins/amd.py
index d5e1673a..d13f0db0 100644
--- a/sos/plugins/amd.py
+++ b/sos/plugins/amd.py
@@ -23,6 +23,6 @@ class amd(Plugin, RedHatPlugin):
packages = ('am-utils',)
def setup(self):
- self.addCopySpecs("/etc/amd.*")
- self.addCmdOutput("/bin/egrep -e 'automount|pid.*nfs' /proc/mounts")
- self.addCmdOutput("/bin/mount | egrep -e 'automount|pid.*nfs'")
+ self.add_copy_specs("/etc/amd.*")
+ self.add_cmd_output("/bin/egrep -e 'automount|pid.*nfs' /proc/mounts")
+ self.add_cmd_output("/bin/mount | egrep -e 'automount|pid.*nfs'")
diff --git a/sos/plugins/anaconda.py b/sos/plugins/anaconda.py
index 06a5b369..2a6d9983 100644
--- a/sos/plugins/anaconda.py
+++ b/sos/plugins/anaconda.py
@@ -36,9 +36,9 @@ class anaconda(Plugin, RedHatPlugin):
"/root/install.log",
"/root/install.log.syslog"]
- self.addCopySpecs(paths)
+ self.add_copy_specs(paths)
def postproc(self):
- self.doFileSub("/root/anaconda-ks.cfg",
+ self.do_file_sub("/root/anaconda-ks.cfg",
r"(\s*rootpw\s*).*",
r"\1******")
diff --git a/sos/plugins/apache.py b/sos/plugins/apache.py
index 077c5fb7..0076534f 100644
--- a/sos/plugins/apache.py
+++ b/sos/plugins/apache.py
@@ -19,7 +19,7 @@ class apache(Plugin):
"""
plugin_name = "apache"
- optionList = [("log", "gathers all apache logs", "slow", False)]
+ option_list = [("log", "gathers all apache logs", "slow", False)]
class RedHatApache(apache, RedHatPlugin):
"""Apache related information for Red Hat distributions
@@ -29,14 +29,14 @@ class RedHatApache(apache, RedHatPlugin):
def setup(self):
super(RedHatApache, self).setup()
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/httpd/conf/httpd.conf",
"/etc/httpd/conf.d/*.conf"])
- self.addForbiddenPath("/etc/httpd/conf/password.conf")
+ self.add_forbidden_path("/etc/httpd/conf/password.conf")
- if self.getOption("log"):
- self.addCopySpec("/var/log/httpd/*")
+ if self.get_option("log"):
+ self.add_copy_spec("/var/log/httpd/*")
class DebianApache(apache, DebianPlugin, UbuntuPlugin):
"""Apache related information for Debian distributions
@@ -45,8 +45,8 @@ class DebianApache(apache, DebianPlugin, UbuntuPlugin):
def setup(self):
super(DebianApache, self).setup()
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/apache2/*",
"/etc/default/apache2"])
- if self.getOption("log"):
- self.addCopySpec("/var/log/apache2/*")
+ if self.get_option("log"):
+ self.add_copy_spec("/var/log/apache2/*")
diff --git a/sos/plugins/apparmor.py b/sos/plugins/apparmor.py
index 06c17c71..cae61c19 100644
--- a/sos/plugins/apparmor.py
+++ b/sos/plugins/apparmor.py
@@ -19,6 +19,6 @@ class apparmor(Plugin, UbuntuPlugin):
"""Apparmor related information
"""
def setup(self):
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/apparmor"
])
diff --git a/sos/plugins/apport.py b/sos/plugins/apport.py
index 83618dbe..7ae319cc 100644
--- a/sos/plugins/apport.py
+++ b/sos/plugins/apport.py
@@ -19,4 +19,4 @@ class apport(Plugin, DebianPlugin, UbuntuPlugin):
"""apport information
"""
def setup(self):
- self.addCopySpec("/etc/apport/*")
+ self.add_copy_spec("/etc/apport/*")
diff --git a/sos/plugins/as7.py b/sos/plugins/as7.py
index 5d427a7c..52f71203 100644
--- a/sos/plugins/as7.py
+++ b/sos/plugins/as7.py
@@ -18,7 +18,7 @@ class AS7(Plugin, IndependentPlugin, AS7Mixin):
version = "1.0"
- optionList = [
+ option_list = [
("home", "JBoss's installation dir (i.e. JBOSS_HOME)", '', False),
("logsize", 'max size (MiB) to collect per log file', '', 15),
("stdjar", 'Collect jar statistics for standard jars.', '', True),
@@ -37,17 +37,17 @@ class AS7(Plugin, IndependentPlugin, AS7Mixin):
def __alert(self, msg):
self.soslog.error(msg)
- self.addAlert(msg)
+ self.add_alert(msg)
def __getJbossHome(self):
self.__jbossHome = self.get_jboss_home()
if not self.__jbossHome:
- self.addAlert("ERROR: The JBoss installation directory was not supplied.\
+ self.add_alert("ERROR: The JBoss installation directory was not supplied.\
The JBoss SOS plug-in cannot continue.")
return False
- self.addAlert("INFO: The JBoss installation directory supplied to SOS is " +
+ self.add_alert("INFO: The JBoss installation directory supplied to SOS is " +
self.__jbossHome)
return True
@@ -94,12 +94,12 @@ class AS7(Plugin, IndependentPlugin, AS7Mixin):
if jar_info_list:
jar_info_list.sort()
- self.addStringAsFile("\n".join([
+ self.add_string_as_file("\n".join([
"%s\n%s\n%s\n===\n" % (name, checksum, manifest)
for (name, checksum, manifest) in jar_info_list]),
'jarinfo.txt')
else:
- self.addAlert("WARN: No jars found in JBoss system path (" + self.__jbossHome + ").")
+ self.add_alert("WARN: No jars found in JBoss system path (" + self.__jbossHome + ").")
def get_online_data(self):
"""
@@ -129,26 +129,26 @@ class AS7(Plugin, IndependentPlugin, AS7Mixin):
for dir_ in configDirAry:
path = os.path.join(self.__jbossHome, dir_)
## First add forbidden files
- self.addForbiddenPath(os.path.join(path, "tmp"))
- self.addForbiddenPath(os.path.join(path, "work"))
- self.addForbiddenPath(os.path.join(path, "data"))
+ self.add_forbidden_path(os.path.join(path, "tmp"))
+ self.add_forbidden_path(os.path.join(path, "work"))
+ self.add_forbidden_path(os.path.join(path, "data"))
if os.path.exists(path):
## First get everything in the conf dir
confDir = os.path.join(path, "configuration")
- self.addForbiddenPath(os.path.join(confDir, 'mgmt-users.properties'))
- self.addForbiddenPath(os.path.join(confDir, 'application-users.properties'))
+ self.add_forbidden_path(os.path.join(confDir, 'mgmt-users.properties'))
+ self.add_forbidden_path(os.path.join(confDir, 'application-users.properties'))
for logFile in find("*.log", path):
- self.addCopySpecLimit(logFile,
- self.getOption("logsize"),
+ self.add_copy_spec_limit(logFile,
+ self.get_option("logsize"),
sub=(self.__jbossHome, 'JBOSSHOME'))
for xml in find("*.xml", path):
- self.addCopySpec(xml, sub=(self.__jbossHome, 'JBOSSHOME'))
+ self.add_copy_spec(xml, sub=(self.__jbossHome, 'JBOSSHOME'))
for prop in find("*.properties", path):
- self.addCopySpec(prop, sub=(self.__jbossHome, 'JBOSSHOME'))
+ self.add_copy_spec(prop, sub=(self.__jbossHome, 'JBOSSHOME'))
deployment_info = self.__get_deployment_info(confDir)
deployments = self.__get_deployments(path)
@@ -156,7 +156,7 @@ class AS7(Plugin, IndependentPlugin, AS7Mixin):
self.__get_listing_from_deployment(deployment, deployment_info)
for xml in find("*.xml", os.path.join(self.__jbossHome, 'modules')):
- self.addCopySpec(xml, sub=(self.__jbossHome, 'JBOSSHOME'))
+ self.add_copy_spec(xml, sub=(self.__jbossHome, 'JBOSSHOME'))
def __get_deployment_info(self, dir_):
"""Gets the deployment name to sha1 mapping for all deployments defined
@@ -199,12 +199,12 @@ class AS7(Plugin, IndependentPlugin, AS7Mixin):
else:
path_to, name = os.path.split(path_to)
- self.addStringAsFile(output, os.path.join(path_to, "%s.txt" % name))
+ self.add_string_as_file(output, os.path.join(path_to, "%s.txt" % name))
except:
# this is probably not a zipfile so we don't care
pass
- def checkenabled(self):
+ def check_enabled(self):
return self.__getJbossHome()
def setup(self):
@@ -217,11 +217,11 @@ class AS7(Plugin, IndependentPlugin, AS7Mixin):
except urllib2.URLError:
pass
- if self.getOption("stdjar"):
+ if self.get_option("stdjar"):
self.__getStdJarInfo()
tree = DirTree(self.__jbossHome).as_string()
- self.addStringAsFile(tree, "jboss_home_tree.txt")
+ self.add_string_as_file(tree, "jboss_home_tree.txt")
self.__getFiles(self.__jbossServerConfigDirs)
@@ -235,19 +235,19 @@ class AS7(Plugin, IndependentPlugin, AS7Mixin):
for dir_ in self.__jbossServerConfigDirs:
path = os.path.join(self.__jbossHome, dir_)
- self.doFileSub(os.path.join(path,"configuration","*.xml"),
+ self.do_file_sub(os.path.join(path,"configuration","*.xml"),
password_xml_regex,
r'<password>********</password>')
tmp = os.path.join(path,"configuration")
for propFile in find("*-users.properties", tmp):
- self.doFileSub(propFile,
+ self.do_file_sub(propFile,
r"=(.*)",
r'=********')
# Remove PW from -ds.xml files
tmp = os.path.join(path, "deployments")
for dsFile in find("*-ds.xml", tmp):
- self.doFileSub(dsFile,
+ self.do_file_sub(dsFile,
password_xml_regex,
r"<password>********</password>")
diff --git a/sos/plugins/auditd.py b/sos/plugins/auditd.py
index 8ccae7f7..41bd8605 100644
--- a/sos/plugins/auditd.py
+++ b/sos/plugins/auditd.py
@@ -18,8 +18,8 @@ class auditd(Plugin, RedHatPlugin):
"""Auditd related information
"""
- optionList = [("syslogsize", "max size (MiB) to collect per syslog file", "", 15)]
+ option_list = [("syslogsize", "max size (MiB) to collect per syslog file", "", 15)]
def setup(self):
- self.addCopySpecs(["/etc/audit/auditd.conf", "/etc/audit/audit.rules"])
- self.addCopySpecLimit("/var/log/audit*", sizelimit = self.getOption("syslogsize"))
+ self.add_copy_specs(["/etc/audit/auditd.conf", "/etc/audit/audit.rules"])
+ self.add_copy_spec_limit("/var/log/audit*", sizelimit = self.get_option("syslogsize"))
diff --git a/sos/plugins/autofs.py b/sos/plugins/autofs.py
index 5d19f8b5..abf90b0f 100644
--- a/sos/plugins/autofs.py
+++ b/sos/plugins/autofs.py
@@ -30,7 +30,7 @@ class autofs(Plugin):
""" testing if autofs debug has been enabled anywhere
"""
# Global debugging
- opt = self.fileGrep(r"^(DEFAULT_LOGGING|DAEMONOPTIONS)=(.*)", *self.files)
+ opt = self.file_grep(r"^(DEFAULT_LOGGING|DAEMONOPTIONS)=(.*)", *self.files)
for opt1 in opt:
for opt2 in opt1.split(" "):
if opt2 in ("--debug", "debug"):
@@ -40,29 +40,29 @@ class autofs(Plugin):
def getdaemondebug(self):
""" capture daemon debug output
"""
- debugout = self.fileGrep(r"^(daemon.*)\s+(\/var\/log\/.*)", *self.files)
+ debugout = self.file_grep(r"^(daemon.*)\s+(\/var\/log\/.*)", *self.files)
for i in debugout:
return i[1]
def setup(self):
- self.addCopySpec("/etc/auto*")
- self.addCmdOutput("/etc/init.d/autofs status")
- self.addCmdOutput("ps auxwww | grep automount")
- self.addCmdOutput("/bin/egrep -e 'automount|pid.*nfs' /proc/mounts")
- self.addCmdOutput("/bin/mount | egrep -e 'automount|pid.*nfs'")
+ self.add_copy_spec("/etc/auto*")
+ self.add_cmd_output("/etc/init.d/autofs status")
+ self.add_cmd_output("ps auxwww | grep automount")
+ self.add_cmd_output("/bin/egrep -e 'automount|pid.*nfs' /proc/mounts")
+ self.add_cmd_output("/bin/mount | egrep -e 'automount|pid.*nfs'")
if self.checkdebug():
- self.addCopySpec(self.getdaemondebug())
+ self.add_copy_spec(self.getdaemondebug())
class RedHatAutofs(autofs, RedHatPlugin):
"""autofs server-related on RedHat based distributions"""
def setup(self):
super(RedHatAutofs, self).setup()
- self.addCmdOutput("/bin/rpm -qV autofs")
+ self.add_cmd_output("/bin/rpm -qV autofs")
class DebianAutofs(autofs, DebianPlugin, UbuntuPlugin):
"""autofs server-related on Debian based distributions"""
def setup(self):
super(DebianAutofs, self).setup()
- self.addCmdOutput("/usr/bin/dpkg-query -s autofs")
+ self.add_cmd_output("/usr/bin/dpkg-query -s autofs")
diff --git a/sos/plugins/azure.py b/sos/plugins/azure.py
index b2c7f415..ed27f8c8 100644
--- a/sos/plugins/azure.py
+++ b/sos/plugins/azure.py
@@ -22,7 +22,7 @@ class azure(Plugin, UbuntuPlugin):
packages = ('walinuxagent',)
def setup(self):
- self.addCopySpecs(["/var/log/waagent*",
+ self.add_copy_specs(["/var/log/waagent*",
"/var/lib/cloud",
"/etc/default/kv-kvp-daemon-init",
"/sys/module/hv_netvsc/parameters/ring_size",
diff --git a/sos/plugins/bootloader.py b/sos/plugins/bootloader.py
index 1c3cde2a..80a2f705 100644
--- a/sos/plugins/bootloader.py
+++ b/sos/plugins/bootloader.py
@@ -18,7 +18,7 @@ class bootloader(Plugin, RedHatPlugin, UbuntuPlugin):
"""Bootloader information
"""
def setup(self):
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/lilo.conf",
"/etc/milo.conf",
"/etc/silo.conf",
@@ -27,5 +27,5 @@ class bootloader(Plugin, RedHatPlugin, UbuntuPlugin):
"/boot/grub/device.map",
"/etc/grub.d",
"/boot/yaboot.conf"])
- self.addCmdOutput("/sbin/lilo -q")
- self.addCmdOutput("/bin/ls -lanR /boot")
+ self.add_cmd_output("/sbin/lilo -q")
+ self.add_cmd_output("/bin/ls -lanR /boot")
diff --git a/sos/plugins/ceph.py b/sos/plugins/ceph.py
index 7d02ce10..7ee3bc07 100644
--- a/sos/plugins/ceph.py
+++ b/sos/plugins/ceph.py
@@ -17,7 +17,7 @@ from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin
class ceph(Plugin, RedHatPlugin, UbuntuPlugin):
"""information on CEPH
"""
- optionList = [("log", "gathers all ceph logs", "slow", False)]
+ option_list = [("log", "gathers all ceph logs", "slow", False)]
packages = ('ceph',
'ceph-mds',
@@ -26,14 +26,14 @@ class ceph(Plugin, RedHatPlugin, UbuntuPlugin):
'ceph-fs-common')
def setup(self):
- self.addCopySpecs(["/etc/ceph/",
+ self.add_copy_specs(["/etc/ceph/",
"/var/log/ceph/"])
- self.addCmdOutput("/usr/bin/ceph status")
- self.addCmdOutput("/usr/bin/ceph health")
- self.addCmdOutput("/usr/bin/ceph osd tree")
- self.addCmdOutput("/usr/bin/ceph osd stat")
- self.addCmdOutput("/usr/bin/ceph osd dump")
- self.addCmdOutput("/usr/bin/ceph mon stat")
- self.addCmdOutput("/usr/bin/ceph mon dump")
+ self.add_cmd_output("/usr/bin/ceph status")
+ self.add_cmd_output("/usr/bin/ceph health")
+ self.add_cmd_output("/usr/bin/ceph osd tree")
+ self.add_cmd_output("/usr/bin/ceph osd stat")
+ self.add_cmd_output("/usr/bin/ceph osd dump")
+ self.add_cmd_output("/usr/bin/ceph mon stat")
+ self.add_cmd_output("/usr/bin/ceph mon dump")
diff --git a/sos/plugins/cgroups.py b/sos/plugins/cgroups.py
index 5b217760..72344c2f 100644
--- a/sos/plugins/cgroups.py
+++ b/sos/plugins/cgroups.py
@@ -25,7 +25,7 @@ class DebianCgroups(cgroups, DebianPlugin, UbuntuPlugin):
files = ('/proc/cgroups',)
def setup(self):
- self.addCopySpecs(["/proc/cgroups",
+ self.add_copy_specs(["/proc/cgroups",
"/sys/fs/cgroup"])
return
@@ -34,7 +34,7 @@ class RedHatCgroups(cgroups, RedHatPlugin):
"""
def setup(self):
- self.addCopySpecs(["/etc/sysconfig/cgconfig",
+ self.add_copy_specs(["/etc/sysconfig/cgconfig",
"/etc/sysconfig/cgred.conf",
"/etc/cgsnapshot_blacklist.conf",
"/etc/cgconfig.conf",
diff --git a/sos/plugins/cloudforms.py b/sos/plugins/cloudforms.py
index 8f6c0a03..aa2b2090 100644
--- a/sos/plugins/cloudforms.py
+++ b/sos/plugins/cloudforms.py
@@ -29,9 +29,9 @@ class cloudforms(Plugin, RedHatPlugin):
katello_debug = "/usr/share/katello/script/katello-debug"
aeolus_debug = "/usr/bin/aeolus-debug"
if os.path.isfile(katello_debug):
- katello_debug_path = os.path.join(self.cInfo['dstroot'],"katello-debug")
- self.addCmdOutput("%s --notar -d %s" % (katello_debug, katello_debug_path))
+ katello_debug_path = os.path.join(self.commons['dstroot'],"katello-debug")
+ self.add_cmd_output("%s --notar -d %s" % (katello_debug, katello_debug_path))
if os.path.isfile(aeolus_debug):
- aeolus_debug_path = os.path.join(self.cInfo['dstroot'],"aeolus-debug")
- self.addCmdOutput("%s --notar -d %s" % (aeolus_debug, aeolus_debug_path))
+ aeolus_debug_path = os.path.join(self.commons['dstroot'],"aeolus-debug")
+ self.add_cmd_output("%s --notar -d %s" % (aeolus_debug, aeolus_debug_path))
diff --git a/sos/plugins/cluster.py b/sos/plugins/cluster.py
index e8076cb0..2383b370 100644
--- a/sos/plugins/cluster.py
+++ b/sos/plugins/cluster.py
@@ -20,12 +20,12 @@ class cluster(Plugin, RedHatPlugin):
"""cluster suite and GFS related information
"""
- optionList = [("gfslockdump",
+ option_list = [("gfslockdump",
'gather output of gfs lockdumps', 'slow', False),
('lockdump', 'gather dlm lockdumps', 'slow', False)]
- def checkenabled(self):
- rhelver = self.policy().rhelVersion()
+ def check_enabled(self):
+ rhelver = self.policy().rhel_version()
if rhelver == 4:
self.packages = [ "ccs", "cman", "cman-kernel", "magma",
"magma-plugins", "rgmanager", "fence", "dlm",
@@ -42,109 +42,109 @@ class cluster(Plugin, RedHatPlugin):
"cman", "clusterlib", "fence-agents" ]
self.files = [ "/etc/cluster/cluster.conf" ]
- return Plugin.checkenabled(self)
+ return Plugin.check_enabled(self)
def setup(self):
- rhelver = self.policy().rhelVersion()
-
- self.addCopySpec("/etc/cluster.conf")
- self.addCopySpec("/etc/cluster.xml")
- self.addCopySpec("/etc/cluster")
- self.addCopySpec("/etc/sysconfig/cluster")
- self.addCopySpec("/etc/sysconfig/cman")
- self.addCopySpec("/etc/fence_virt.conf")
- self.addCopySpec("/var/lib/ricci")
- self.addCopySpec("/var/lib/luci")
- self.addCopySpec("/var/log/cluster")
- self.addCopySpec("/var/log/luci/luci.log")
- self.addCopySpec("/etc/fence_virt.conf")
-
- if self.getOption('gfslockdump'):
+ rhelver = self.policy().rhel_version()
+
+ self.add_copy_spec("/etc/cluster.conf")
+ self.add_copy_spec("/etc/cluster.xml")
+ self.add_copy_spec("/etc/cluster")
+ self.add_copy_spec("/etc/sysconfig/cluster")
+ self.add_copy_spec("/etc/sysconfig/cman")
+ self.add_copy_spec("/etc/fence_virt.conf")
+ self.add_copy_spec("/var/lib/ricci")
+ self.add_copy_spec("/var/lib/luci")
+ self.add_copy_spec("/var/log/cluster")
+ self.add_copy_spec("/var/log/luci/luci.log")
+ self.add_copy_spec("/etc/fence_virt.conf")
+
+ if self.get_option('gfslockdump'):
self.do_gfslockdump()
- if self.getOption('lockdump'):
+ if self.get_option('lockdump'):
self.do_lockdump()
- self.addCmdOutput("/usr/sbin/rg_test test "
+ self.add_cmd_output("/usr/sbin/rg_test test "
+ "/etc/cluster/cluster.conf" )
- self.addCmdOutput("fence_tool ls -n")
- self.addCmdOutput("gfs_control ls -n")
- self.addCmdOutput("dlm_tool log_plock")
-
- self.addCmdOutput("/sbin/fdisk -l")
- self.getCmdOutputNow("clustat")
- self.getCmdOutputNow("group_tool dump")
- self.addCmdOutput("cman_tool services")
- self.addCmdOutput("cman_tool nodes")
- self.addCmdOutput("cman_tool status")
- self.addCmdOutput("ccs_tool lsnode")
- self.addCmdOutput("/sbin/ipvsadm -L")
+ self.add_cmd_output("fence_tool ls -n")
+ self.add_cmd_output("gfs_control ls -n")
+ self.add_cmd_output("dlm_tool log_plock")
+
+ self.add_cmd_output("/sbin/fdisk -l")
+ self.get_cmd_output_now("clustat")
+ self.get_cmd_output_now("group_tool dump")
+ self.add_cmd_output("cman_tool services")
+ self.add_cmd_output("cman_tool nodes")
+ self.add_cmd_output("cman_tool status")
+ self.add_cmd_output("ccs_tool lsnode")
+ self.add_cmd_output("/sbin/ipvsadm -L")
if rhelver is 4:
- self.addCopySpec("/proc/cluster/*")
- self.addCmdOutput("cman_tool nodes")
+ self.add_copy_spec("/proc/cluster/*")
+ self.add_cmd_output("cman_tool nodes")
if rhelver is not 4: # 5+
- self.addCmdOutput("cman_tool -a nodes")
+ self.add_cmd_output("cman_tool -a nodes")
if rhelver is 5:
- self.addCmdOutput("group_tool -v")
- self.addCmdOutput("group_tool dump fence")
- self.addCmdOutput("group_tool dump gfs")
+ self.add_cmd_output("group_tool -v")
+ self.add_cmd_output("group_tool dump fence")
+ self.add_cmd_output("group_tool dump gfs")
if rhelver not in (4,5): # 6+
- self.addCmdOutput("corosync-quorumtool -l")
- self.addCmdOutput("corosync-quorumtool -s")
- self.addCmdOutput("corosync-cpgtool")
- self.addCmdOutput("corosync-objctl")
- self.addCmdOutput("group_tool ls -g1")
- self.addCmdOutput("gfs_control ls -n")
- self.addCmdOutput("gfs_control dump")
- self.addCmdOutput("fence_tool dump")
- self.addCmdOutput("dlm_tool dump")
- self.addCmdOutput("dlm_tool ls -n")
- self.addCmdOutput("mkqdisk -L")
+ self.add_cmd_output("corosync-quorumtool -l")
+ self.add_cmd_output("corosync-quorumtool -s")
+ self.add_cmd_output("corosync-cpgtool")
+ self.add_cmd_output("corosync-objctl")
+ self.add_cmd_output("group_tool ls -g1")
+ self.add_cmd_output("gfs_control ls -n")
+ self.add_cmd_output("gfs_control dump")
+ self.add_cmd_output("fence_tool dump")
+ self.add_cmd_output("dlm_tool dump")
+ self.add_cmd_output("dlm_tool ls -n")
+ self.add_cmd_output("mkqdisk -L")
def do_lockdump(self):
- rhelver = self.policy().rhelVersion()
+ rhelver = self.policy().rhel_version()
if rhelver is 4:
- status, output, time = self.callExtProg("cman_tool services")
+ status, output, time = self.call_ext_prog("cman_tool services")
for lockspace in re.compile(r'^DLM Lock Space:\s*"([^"]*)".*$',
re.MULTILINE).findall(output):
- self.callExtProg("echo %s > /proc/cluster/dlm_locks"
+ self.call_ext_prog("echo %s > /proc/cluster/dlm_locks"
% lockspace)
- self.getCmdOutputNow("cat /proc/cluster/dlm_locks",
+ self.get_cmd_output_now("cat /proc/cluster/dlm_locks",
suggest_filename = "dlm_locks_%s" % lockspace)
if rhelver is 5:
- status, output, time = self.callExtProg("group_tool")
+ status, output, time = self.call_ext_prog("group_tool")
for lockspace in re.compile(r'^dlm\s+[^\s]+\s+([^\s]+)$',
re.MULTILINE).findall(output):
- self.addCmdOutput("dlm_tool lockdebug '%s'" % lockspace,
+ self.add_cmd_output("dlm_tool lockdebug '%s'" % lockspace,
suggest_filename = "dlm_locks_%s" % lockspace)
else: # RHEL6 or recent Fedora
- status, output, time = self.callExtProg("dlm_tool ls")
+ status, output, time = self.call_ext_prog("dlm_tool ls")
for lockspace in re.compile(r'^name\s+([^\s]+)$',
re.MULTILINE).findall(output):
- self.addCmdOutput("dlm_tool lockdebug -svw '%s'"
+ self.add_cmd_output("dlm_tool lockdebug -svw '%s'"
% lockspace,
suggest_filename = "dlm_locks_%s" % lockspace)
def do_gfslockdump(self):
- for mntpoint in self.doRegexFindAll(r'^\S+\s+([^\s]+)\s+gfs\s+.*$',
+ for mntpoint in self.do_regex_find_all(r'^\S+\s+([^\s]+)\s+gfs\s+.*$',
"/proc/mounts"):
- self.addCmdOutput("/sbin/gfs_tool lockdump %s" % mntpoint,
+ self.add_cmd_output("/sbin/gfs_tool lockdump %s" % mntpoint,
suggest_filename = "gfs_lockdump_"
- + self.mangleCommand(mntpoint))
+ + self.mangle_command(mntpoint))
def postproc(self):
for cluster_conf in glob("/etc/cluster/cluster.conf*"):
- self.doFileSub(cluster_conf,
+ self.do_file_sub(cluster_conf,
r"(\s*\<fencedevice\s*.*\s*passwd\s*=\s*)\S+(\")",
r"\1%s" %('"***"'))
- self.doCmdOutputSub("corosync-objctl",
+ self.do_cmd_output_sub("corosync-objctl",
r"(.*fence.*\.passwd=)(.*)",
r"\1******")
return
diff --git a/sos/plugins/cobbler.py b/sos/plugins/cobbler.py
index 5ad1d062..3d8c9faf 100644
--- a/sos/plugins/cobbler.py
+++ b/sos/plugins/cobbler.py
@@ -24,10 +24,10 @@ class RedHatCobbler(cobbler, RedHatPlugin):
packages = ('cobbler',)
def setup(self):
- self.addCopySpec("/etc/cobbler")
- self.addCopySpec("/var/log/cobbler")
- self.addCopySpec("/var/lib/rhn/kickstarts")
- self.addCopySpec("/var/lib/cobbler")
+ self.add_copy_spec("/etc/cobbler")
+ self.add_copy_spec("/var/log/cobbler")
+ self.add_copy_spec("/var/lib/rhn/kickstarts")
+ self.add_copy_spec("/var/lib/cobbler")
class DebianCobbler(cobbler, DebianPlugin, UbuntuPlugin):
"""cobbler related information for Debian and Ubuntu
@@ -36,6 +36,6 @@ class DebianCobbler(cobbler, DebianPlugin, UbuntuPlugin):
packages = ('cobbler',)
def setup(self):
- self.addCopySpec("/etc/cobbler")
- self.addCopySpec("/var/log/cobbler")
- self.addCopySpec("/var/lib/cobbler")
+ self.add_copy_spec("/etc/cobbler")
+ self.add_copy_spec("/var/log/cobbler")
+ self.add_copy_spec("/var/lib/cobbler")
diff --git a/sos/plugins/corosync.py b/sos/plugins/corosync.py
index 6fb0ad0a..b02d99a6 100644
--- a/sos/plugins/corosync.py
+++ b/sos/plugins/corosync.py
@@ -22,15 +22,15 @@ class corosync(Plugin, RedHatPlugin):
packages = ('corosync',)
def setup(self):
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/corosync",
"/var/lib/corosync/fdata",
"/var/log/cluster/corosync.log"])
- self.addCmdOutput("corosync-quorumtool -l")
- self.addCmdOutput("corosync-quorumtool -s")
- self.addCmdOutput("corosync-cpgtool")
- self.addCmdOutput("corosync-objctl -a")
- self.addCmdOutput("corosync-fplay")
- self.addCmdOutput("/usr/sbin/corosync-objctl -w runtime.blackbox.dump_state=$(date +\%s)")
- self.addCmdOutput("/usr/sbin/corosync-objctl -w runtime.blackbox.dump_flight_data=$(date +\%s)")
- self.callExtProg("killall -USR2 corosync")
+ self.add_cmd_output("corosync-quorumtool -l")
+ self.add_cmd_output("corosync-quorumtool -s")
+ self.add_cmd_output("corosync-cpgtool")
+ self.add_cmd_output("corosync-objctl -a")
+ self.add_cmd_output("corosync-fplay")
+ self.add_cmd_output("/usr/sbin/corosync-objctl -w runtime.blackbox.dump_state=$(date +\%s)")
+ self.add_cmd_output("/usr/sbin/corosync-objctl -w runtime.blackbox.dump_flight_data=$(date +\%s)")
+ self.call_ext_prog("killall -USR2 corosync")
diff --git a/sos/plugins/crontab.py b/sos/plugins/crontab.py
index 8125aafd..e5323ba2 100644
--- a/sos/plugins/crontab.py
+++ b/sos/plugins/crontab.py
@@ -21,8 +21,8 @@ class crontab(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
plugin_name = "crontab"
def setup(self):
- self.addCopySpec("/etc/cron*")
- self.addCmdOutput("/usr/bin/crontab -l -u root", suggest_filename = "root_crontab")
- self.addCmdOutput("""for i in `ls /home/`;\
+ self.add_copy_spec("/etc/cron*")
+ self.add_cmd_output("/usr/bin/crontab -l -u root", suggest_filename = "root_crontab")
+ self.add_cmd_output("""for i in `ls /home/`;\
do echo "User :" $i;/usr/bin/crontab -l -u $i;\
echo "---------------";done""", suggest_filename = "users_crontabs")
diff --git a/sos/plugins/cs.py b/sos/plugins/cs.py
index 1d518117..e594ac2d 100644
--- a/sos/plugins/cs.py
+++ b/sos/plugins/cs.py
@@ -25,19 +25,19 @@ class cs(Plugin, RedHatPlugin):
"""
def checkversion(self):
- if self.isInstalled("redhat-cs") or exists("/opt/redhat-cs"):
+ if self.is_installed("redhat-cs") or exists("/opt/redhat-cs"):
return 71
- elif self.isInstalled("rhpki-common") or len(glob("/var/lib/rhpki-*")):
+ elif self.is_installed("rhpki-common") or len(glob("/var/lib/rhpki-*")):
return 73
# 8 should cover dogtag
- elif self.isInstalled("pki-common") or exists("/usr/share/java/pki"):
+ elif self.is_installed("pki-common") or exists("/usr/share/java/pki"):
return 8
return False
- def checkenabled(self):
- if self.isInstalled("redhat-cs") or \
- self.isInstalled("rhpki-common") or \
- self.isInstalled("pki-common") or \
+ def check_enabled(self):
+ if self.is_installed("redhat-cs") or \
+ self.is_installed("rhpki-common") or \
+ self.is_installed("pki-common") or \
exists("/opt/redhat-cs") or \
exists("/usr/share/java/rhpki") or \
exists("/usr/share/java/pki"):
@@ -47,10 +47,10 @@ class cs(Plugin, RedHatPlugin):
def setup(self):
csversion = self.checkversion()
if not csversion:
- self.addAlert("Red Hat Certificate System not found.")
+ self.add_alert("Red Hat Certificate System not found.")
return
if csversion == 71:
- self.addCopySpecs([
+ self.add_copy_specs([
"/opt/redhat-cs/slapd-*/logs/access",
"/opt/redhat-cs/slapd-*/logs/errors",
"/opt/redhat-cs/slapd-*/config/dse.ldif",
@@ -63,7 +63,7 @@ class cs(Plugin, RedHatPlugin):
"/opt/redhat-cs/cert-*/debug",
"/opt/redhat-cs/cert-*/tps-debug.log"])
if csversion == 73:
- self.addCopySpecs([
+ self.add_copy_specs([
"/var/lib/rhpki-*/conf/*cfg*",
"/var/lib/rhpki-*/conf/*.ldif",
"/var/lib/rhpki-*/logs/debug",
@@ -72,12 +72,12 @@ class cs(Plugin, RedHatPlugin):
"/var/lib/rhpki-*/logs/transactions",
"/var/lib/rhpki-*/logs/system"])
if csversion in (73, 8):
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/dirsrv/slapd-*/dse.ldif",
"/var/log/dirsrv/slapd-*/access",
"/var/log/dirsrv/slapd-*/errors"])
if csversion == 8:
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/pki-*/CS.cfg",
"/var/lib/pki-*/conf/*cfg*",
"/var/log/pki-*/debug",
diff --git a/sos/plugins/devicemapper.py b/sos/plugins/devicemapper.py
index 288472a8..aac90193 100644
--- a/sos/plugins/devicemapper.py
+++ b/sos/plugins/devicemapper.py
@@ -19,51 +19,51 @@ class devicemapper(Plugin, RedHatPlugin):
"""device-mapper related information (dm, lvm, multipath)
"""
- optionList = [("lvmdump", 'collect raw metadata from PVs', 'slow', False)]
- optionList = [("lvmdump-a", 'use the -a option of lvmdump (requires the "lvmdump" option)', 'slow', False)]
- dmraidOptions = ['V','b','r','s','tay','rD']
+ option_list = [("lvmdump", 'collect raw metadata from PVs', 'slow', False)]
+ option_list = [("lvmdump-a", 'use the -a option of lvmdump (requires the "lvmdump" option)', 'slow', False)]
+ dmraid_options = ['V','b','r','s','tay','rD']
def do_lvmdump(self):
"""Collects raw metadata directly from the PVs using dd
"""
- cmd = "lvmdump -d '%s'" % os.path.join(self.cInfo['dstroot'],"lvmdump")
- if self.getOption('lvmdump-a'):
+ cmd = "lvmdump -d '%s'" % os.path.join(self.commons['dstroot'],"lvmdump")
+ if self.get_option('lvmdump-a'):
cmd += " -a"
- self.addCmdOutput(cmd)
+ self.add_cmd_output(cmd)
def setup(self):
- self.addCmdOutput("/sbin/dmsetup info -c")
- self.addCmdOutput("/sbin/dmsetup table")
- self.addCmdOutput("/sbin/dmsetup status")
- self.addCmdOutput("/sbin/dmsetup ls --tree")
+ self.add_cmd_output("/sbin/dmsetup info -c")
+ self.add_cmd_output("/sbin/dmsetup table")
+ self.add_cmd_output("/sbin/dmsetup status")
+ self.add_cmd_output("/sbin/dmsetup ls --tree")
- self.addCmdOutput("/sbin/vgdisplay -vv", root_symlink = "vgdisplay")
- self.addCmdOutput("/sbin/vgscan -vvv")
- self.addCmdOutput("/sbin/pvscan -v")
- self.addCmdOutput("/sbin/lvs -a -o +devices")
- self.addCmdOutput("/sbin/pvs -a -v")
- self.addCmdOutput("/sbin/vgs -v")
- self.addCmdOutput("/sbin/mdadm -D /dev/md*")
+ self.add_cmd_output("/sbin/vgdisplay -vv", root_symlink = "vgdisplay")
+ self.add_cmd_output("/sbin/vgscan -vvv")
+ self.add_cmd_output("/sbin/pvscan -v")
+ self.add_cmd_output("/sbin/lvs -a -o +devices")
+ self.add_cmd_output("/sbin/pvs -a -v")
+ self.add_cmd_output("/sbin/vgs -v")
+ self.add_cmd_output("/sbin/mdadm -D /dev/md*")
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/lvm",
"/etc/multipath/",
"/etc/multipath.conf",
"/var/lib/multipath/bindings"])
- self.addCmdOutput("/sbin/multipath -v4 -ll")
+ self.add_cmd_output("/sbin/multipath -v4 -ll")
- self.addCmdOutput("/usr/bin/systool -v -c -b scsi")
+ self.add_cmd_output("/usr/bin/systool -v -c -b scsi")
- self.addCmdOutput("/bin/ls -lanR /dev")
- self.addCmdOutput("/bin/ls -lanR /sys/block")
+ self.add_cmd_output("/bin/ls -lanR /dev")
+ self.add_cmd_output("/bin/ls -lanR /sys/block")
- if self.getOption('lvmdump'):
+ if self.get_option('lvmdump'):
self.do_lvmdump()
if os.path.isdir("/sys/block"):
for disk in os.listdir("/sys/block"):
if disk in [ ".", ".." ] or disk.startswith("ram"):
continue
- self.addCmdOutput("/usr/bin/udevinfo -ap /sys/block/%s" % (disk))
- for opt in self.dmraidOptions:
- self.addCmdOutput("/sbin/dmraid -%s" % (opt,))
+ self.add_cmd_output("/usr/bin/udevinfo -ap /sys/block/%s" % (disk))
+ for opt in self.dmraid_options:
+ self.add_cmd_output("/sbin/dmraid -%s" % (opt,))
diff --git a/sos/plugins/dhcp.py b/sos/plugins/dhcp.py
index 772ea35b..ccddd75d 100644
--- a/sos/plugins/dhcp.py
+++ b/sos/plugins/dhcp.py
@@ -28,7 +28,7 @@ class RedHatDhcp(dhcp, RedHatPlugin):
def setup(self):
super(DhcpRedHat, self).setup()
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/dhcpd.conf",
"/etc/dhcp"])
@@ -40,7 +40,7 @@ class UbuntuDhcp(dhcp, UbuntuPlugin):
def setup(self):
super(DhcpDebian, self).setup()
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/default/udhcpd",
"/etc/udhcpd.conf"
])
diff --git a/sos/plugins/dovecot.py b/sos/plugins/dovecot.py
index ae6addb3..534f2e4c 100644
--- a/sos/plugins/dovecot.py
+++ b/sos/plugins/dovecot.py
@@ -20,5 +20,5 @@ class dovecot(Plugin, RedHatPlugin):
"""
def setup(self):
if os.path.exists("/etc/dovecot.conf"):
- self.addCopySpec("/etc/dovecot*")
- self.addCmdOutput("/usr/sbin/dovecot -n")
+ self.add_copy_spec("/etc/dovecot*")
+ self.add_cmd_output("/usr/sbin/dovecot -n")
diff --git a/sos/plugins/dpkg.py b/sos/plugins/dpkg.py
index 2610ce57..b95db952 100644
--- a/sos/plugins/dpkg.py
+++ b/sos/plugins/dpkg.py
@@ -19,5 +19,5 @@ class dpkg(Plugin, DebianPlugin, UbuntuPlugin):
"""dpkg information
"""
def setup(self):
- self.addCopySpec("/var/log/dpkg.log")
- self.addCmdOutput("/usr/bin/dpkg -l", root_symlink = "installed-debs")
+ self.add_copy_spec("/var/log/dpkg.log")
+ self.add_cmd_output("/usr/bin/dpkg -l", root_symlink = "installed-debs")
diff --git a/sos/plugins/ds.py b/sos/plugins/ds.py
index df5df197..46a0730b 100644
--- a/sos/plugins/ds.py
+++ b/sos/plugins/ds.py
@@ -25,22 +25,22 @@ class ds(Plugin, RedHatPlugin):
packages = ('redhat-ds-base', 'redhat-ds-7')
def check_version(self):
- if self.isInstalled("redhat-ds-base") or \
+ if self.is_installed("redhat-ds-base") or \
os.path.exists("/etc/dirsrv"):
return "ds8"
- elif self.isInstalled("redhat-ds-7") or \
+ elif self.is_installed("redhat-ds-7") or \
os.path.exists("/opt/redhat-ds"):
return "ds7"
return False
def setup(self):
if not self.check_version():
- self.addAlert("Directory Server not found.")
+ self.add_alert("Directory Server not found.")
elif "ds8" in self.check_version():
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/dirsrv/slapd*",
"/var/log/dirsrv/*"])
elif "ds7" in self.check_version():
- self.addCopySpecs([
+ self.add_copy_specs([
"/opt/redhat-ds/slapd-*/config",
"/opt/redhat-ds/slapd-*/logs"])
diff --git a/sos/plugins/emc.py b/sos/plugins/emc.py
index 7a625e66..c386e70e 100644
--- a/sos/plugins/emc.py
+++ b/sos/plugins/emc.py
@@ -25,19 +25,19 @@ class emc(Plugin, RedHatPlugin):
def about_emc(self):
""" EMC Corporation specific information
"""
- self.addCustomText('<center><h1><font size="+4"color="blue">EMC&sup2;</font><font size="-2" color="blue">&reg;</font>')
- self.addCustomText('<br><font size="+1">where information lives</font><font size="-2">&reg;</font></h1>')
- self.addCustomText("EMC Corporation is the world's leading developer and provider of information ")
- self.addCustomText("infrastructure technology and solutions that enable organizations of all sizes to transform ")
- self.addCustomText("the way they compete and create value from their information. &nbsp;")
- self.addCustomText("Information about EMC's products and services can be found at ")
- self.addCustomText('<a href="http://www.EMC.com/">www.EMC.com</a>.</center>')
+ self.add_custom_text('<center><h1><font size="+4"color="blue">EMC&sup2;</font><font size="-2" color="blue">&reg;</font>')
+ self.add_custom_text('<br><font size="+1">where information lives</font><font size="-2">&reg;</font></h1>')
+ self.add_custom_text("EMC Corporation is the world's leading developer and provider of information ")
+ self.add_custom_text("infrastructure technology and solutions that enable organizations of all sizes to transform ")
+ self.add_custom_text("the way they compete and create value from their information. &nbsp;")
+ self.add_custom_text("Information about EMC's products and services can be found at ")
+ self.add_custom_text('<a href="http://www.EMC.com/">www.EMC.com</a>.</center>')
def get_pp_files(self):
""" EMC PowerPath specific information - files
"""
- self.addCmdOutput("/sbin/powermt version")
- self.addCopySpecs([
+ self.add_cmd_output("/sbin/powermt version")
+ self.add_copy_specs([
"/etc/init.d/PowerPath",
"/etc/powermt.custom",
"/etc/emcp_registration",
@@ -51,18 +51,18 @@ class emc(Plugin, RedHatPlugin):
def get_pp_config(self):
""" EMC PowerPath specific information - commands
"""
- self.addCmdOutput("/sbin/powermt display")
- self.addCmdOutput("/sbin/powermt display dev=all")
- self.addCmdOutput("/sbin/powermt check_registration")
- self.addCmdOutput("/sbin/powermt display options")
- self.addCmdOutput("/sbin/powermt display ports")
- self.addCmdOutput("/sbin/powermt display paths")
- self.addCmdOutput("/sbin/powermt dump")
+ self.add_cmd_output("/sbin/powermt display")
+ self.add_cmd_output("/sbin/powermt display dev=all")
+ self.add_cmd_output("/sbin/powermt check_registration")
+ self.add_cmd_output("/sbin/powermt display options")
+ self.add_cmd_output("/sbin/powermt display ports")
+ self.add_cmd_output("/sbin/powermt display paths")
+ self.add_cmd_output("/sbin/powermt dump")
def get_symcli_files(self):
""" EMC Solutions Enabler SYMCLI specific information - files
"""
- self.addCopySpecs([
+ self.add_copy_specs([
"/var/symapi/db/symapi_db.bin",
"/var/symapi/config/[a-z]*",
"/var/symapi/log/[a-z]*"])
@@ -70,56 +70,56 @@ class emc(Plugin, RedHatPlugin):
def get_symcli_config(self):
""" EMC Solutions Enabler SYMCLI specific information - Symmetrix/DMX - commands
"""
- self.addCmdOutput("/usr/symcli/bin/symcli -def")
- self.addCmdOutput("/usr/symcli/bin/symdg list")
- self.addCmdOutput("/usr/symcli/bin/symdg -v list")
- self.addCmdOutput("/usr/symcli/bin/symcg list")
- self.addCmdOutput("/usr/symcli/bin/symcg -v list")
- self.addCmdOutput("/usr/symcli/bin/symcfg list")
- self.addCmdOutput("/usr/symcli/bin/symcfg -v list")
- self.addCmdOutput("/usr/symcli/bin/symcfg -db")
- self.addCmdOutput("/usr/symcli/bin/symcfg -semaphores list")
- self.addCmdOutput("/usr/symcli/bin/symcfg -dir all -v list")
- self.addCmdOutput("/usr/symcli/bin/symcfg -connections list")
- self.addCmdOutput("/usr/symcli/bin/symcfg -app -v list")
- self.addCmdOutput("/usr/symcli/bin/symcfg -fa all -port list")
- self.addCmdOutput("/usr/symcli/bin/symcfg -ra all -port list")
- self.addCmdOutput("/usr/symcli/bin/symcfg -sa all -port list")
- self.addCmdOutput("/usr/symcli/bin/symcfg list -lock")
- self.addCmdOutput("/usr/symcli/bin/symcfg list -lockn all")
- self.addCmdOutput("/usr/symcli/bin/syminq")
- self.addCmdOutput("/usr/symcli/bin/syminq -v")
- self.addCmdOutput("/usr/symcli/bin/syminq -symmids")
- self.addCmdOutput("/usr/symcli/bin/syminq hba -fibre")
- self.addCmdOutput("/usr/symcli/bin/syminq hba -scsi")
- self.addCmdOutput("/usr/symcli/bin/symhost show -config")
- self.addCmdOutput("/usr/symcli/bin/stordaemon list")
- self.addCmdOutput("/usr/symcli/bin/stordaemon -v list")
- self.addCmdOutput("/usr/symcli/bin/sympd list")
- self.addCmdOutput("/usr/symcli/bin/sympd list -vcm")
- self.addCmdOutput("/usr/symcli/bin/symdev list")
- self.addCmdOutput("/usr/symcli/bin/symdev -v list")
- self.addCmdOutput("/usr/symcli/bin/symdev -rdfa list")
- self.addCmdOutput("/usr/symcli/bin/symdev -rdfa -v list")
- self.addCmdOutput("/usr/symcli/bin/symbcv list")
- self.addCmdOutput("/usr/symcli/bin/symbcv -v list")
- self.addCmdOutput("/usr/symcli/bin/symrdf list")
- self.addCmdOutput("/usr/symcli/bin/symrdf -v list")
- self.addCmdOutput("/usr/symcli/bin/symrdf -rdfa list")
- self.addCmdOutput("/usr/symcli/bin/symrdf -rdfa -v list")
- self.addCmdOutput("/usr/symcli/bin/symsnap list")
- self.addCmdOutput("/usr/symcli/bin/symsnap list -savedevs")
- self.addCmdOutput("/usr/symcli/bin/symclone list")
- self.addCmdOutput("/usr/symcli/bin/symevent list")
- self.addCmdOutput("/usr/symcli/bin/symmask list hba")
- self.addCmdOutput("/usr/symcli/bin/symmask list logins")
- self.addCmdOutput("/usr/symcli/bin/symmaskdb list database")
- self.addCmdOutput("/usr/symcli/bin/symmaskdb -v list database")
+ self.add_cmd_output("/usr/symcli/bin/symcli -def")
+ self.add_cmd_output("/usr/symcli/bin/symdg list")
+ self.add_cmd_output("/usr/symcli/bin/symdg -v list")
+ self.add_cmd_output("/usr/symcli/bin/symcg list")
+ self.add_cmd_output("/usr/symcli/bin/symcg -v list")
+ self.add_cmd_output("/usr/symcli/bin/symcfg list")
+ self.add_cmd_output("/usr/symcli/bin/symcfg -v list")
+ self.add_cmd_output("/usr/symcli/bin/symcfg -db")
+ self.add_cmd_output("/usr/symcli/bin/symcfg -semaphores list")
+ self.add_cmd_output("/usr/symcli/bin/symcfg -dir all -v list")
+ self.add_cmd_output("/usr/symcli/bin/symcfg -connections list")
+ self.add_cmd_output("/usr/symcli/bin/symcfg -app -v list")
+ self.add_cmd_output("/usr/symcli/bin/symcfg -fa all -port list")
+ self.add_cmd_output("/usr/symcli/bin/symcfg -ra all -port list")
+ self.add_cmd_output("/usr/symcli/bin/symcfg -sa all -port list")
+ self.add_cmd_output("/usr/symcli/bin/symcfg list -lock")
+ self.add_cmd_output("/usr/symcli/bin/symcfg list -lockn all")
+ self.add_cmd_output("/usr/symcli/bin/syminq")
+ self.add_cmd_output("/usr/symcli/bin/syminq -v")
+ self.add_cmd_output("/usr/symcli/bin/syminq -symmids")
+ self.add_cmd_output("/usr/symcli/bin/syminq hba -fibre")
+ self.add_cmd_output("/usr/symcli/bin/syminq hba -scsi")
+ self.add_cmd_output("/usr/symcli/bin/symhost show -config")
+ self.add_cmd_output("/usr/symcli/bin/stordaemon list")
+ self.add_cmd_output("/usr/symcli/bin/stordaemon -v list")
+ self.add_cmd_output("/usr/symcli/bin/sympd list")
+ self.add_cmd_output("/usr/symcli/bin/sympd list -vcm")
+ self.add_cmd_output("/usr/symcli/bin/symdev list")
+ self.add_cmd_output("/usr/symcli/bin/symdev -v list")
+ self.add_cmd_output("/usr/symcli/bin/symdev -rdfa list")
+ self.add_cmd_output("/usr/symcli/bin/symdev -rdfa -v list")
+ self.add_cmd_output("/usr/symcli/bin/symbcv list")
+ self.add_cmd_output("/usr/symcli/bin/symbcv -v list")
+ self.add_cmd_output("/usr/symcli/bin/symrdf list")
+ self.add_cmd_output("/usr/symcli/bin/symrdf -v list")
+ self.add_cmd_output("/usr/symcli/bin/symrdf -rdfa list")
+ self.add_cmd_output("/usr/symcli/bin/symrdf -rdfa -v list")
+ self.add_cmd_output("/usr/symcli/bin/symsnap list")
+ self.add_cmd_output("/usr/symcli/bin/symsnap list -savedevs")
+ self.add_cmd_output("/usr/symcli/bin/symclone list")
+ self.add_cmd_output("/usr/symcli/bin/symevent list")
+ self.add_cmd_output("/usr/symcli/bin/symmask list hba")
+ self.add_cmd_output("/usr/symcli/bin/symmask list logins")
+ self.add_cmd_output("/usr/symcli/bin/symmaskdb list database")
+ self.add_cmd_output("/usr/symcli/bin/symmaskdb -v list database")
def get_navicli_config(self):
""" EMC Navisphere Host Agent NAVICLI specific information - files
"""
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/Navisphere/agent.config",
"/etc/Navisphere/Navimon.cfg",
"/etc/Navisphere/Quietmode.cfg",
@@ -129,24 +129,24 @@ class emc(Plugin, RedHatPlugin):
def get_navicli_SP_info(self,SP_address):
""" EMC Navisphere Host Agent NAVICLI specific information - CLARiiON - commands
"""
- self.addCmdOutput("/opt/Navisphere/bin/navicli -h %s getall" % SP_address)
- self.addCmdOutput("/opt/Navisphere/bin/navicli -h %s getsptime -spa" % SP_address)
- self.addCmdOutput("/opt/Navisphere/bin/navicli -h %s getsptime -spb" % SP_address)
- self.addCmdOutput("/opt/Navisphere/bin/navicli -h %s getlog" % SP_address)
- self.addCmdOutput("/opt/Navisphere/bin/navicli -h %s getdisk" % SP_address)
- self.addCmdOutput("/opt/Navisphere/bin/navicli -h %s getcache" % SP_address)
- self.addCmdOutput("/opt/Navisphere/bin/navicli -h %s getlun" % SP_address)
- self.addCmdOutput("/opt/Navisphere/bin/navicli -h %s getlun -rg -type -default -owner -crus -capacity" % SP_address)
- self.addCmdOutput("/opt/Navisphere/bin/navicli -h %s lunmapinfo" % SP_address)
- self.addCmdOutput("/opt/Navisphere/bin/navicli -h %s getcrus" % SP_address)
- self.addCmdOutput("/opt/Navisphere/bin/navicli -h %s port -list -all" % SP_address)
- self.addCmdOutput("/opt/Navisphere/bin/navicli -h %s storagegroup -list" % SP_address)
- self.addCmdOutput("/opt/Navisphere/bin/navicli -h %s spportspeed -get" % SP_address)
-
- def checkenabled(self):
+ self.add_cmd_output("/opt/Navisphere/bin/navicli -h %s getall" % SP_address)
+ self.add_cmd_output("/opt/Navisphere/bin/navicli -h %s getsptime -spa" % SP_address)
+ self.add_cmd_output("/opt/Navisphere/bin/navicli -h %s getsptime -spb" % SP_address)
+ self.add_cmd_output("/opt/Navisphere/bin/navicli -h %s getlog" % SP_address)
+ self.add_cmd_output("/opt/Navisphere/bin/navicli -h %s getdisk" % SP_address)
+ self.add_cmd_output("/opt/Navisphere/bin/navicli -h %s getcache" % SP_address)
+ self.add_cmd_output("/opt/Navisphere/bin/navicli -h %s getlun" % SP_address)
+ self.add_cmd_output("/opt/Navisphere/bin/navicli -h %s getlun -rg -type -default -owner -crus -capacity" % SP_address)
+ self.add_cmd_output("/opt/Navisphere/bin/navicli -h %s lunmapinfo" % SP_address)
+ self.add_cmd_output("/opt/Navisphere/bin/navicli -h %s getcrus" % SP_address)
+ self.add_cmd_output("/opt/Navisphere/bin/navicli -h %s port -list -all" % SP_address)
+ self.add_cmd_output("/opt/Navisphere/bin/navicli -h %s storagegroup -list" % SP_address)
+ self.add_cmd_output("/opt/Navisphere/bin/navicli -h %s spportspeed -get" % SP_address)
+
+ def check_enabled(self):
self.packages = [ "EMCpower" ]
self.files = [ "/opt/Navisphere/bin", "/proc/emcp" ]
- return Plugin.checkenabled(self)
+ return Plugin.check_enabled(self)
def setup(self):
from subprocess import Popen, PIPE
@@ -154,10 +154,10 @@ class emc(Plugin, RedHatPlugin):
add_about_emc="no"
## If PowerPath is installed collect PowerPath specific information
- if self.isInstalled("EMCpower"):
+ if self.is_installed("EMCpower"):
print "EMC PowerPath is installed."
print " Gathering EMC PowerPath information..."
- self.addCustomText("EMC PowerPath is installed.<br>")
+ self.add_custom_text("EMC PowerPath is installed.<br>")
self.get_pp_files()
add_about_emc = "yes"
@@ -168,10 +168,10 @@ class emc(Plugin, RedHatPlugin):
self.get_pp_config()
## If Solutions Enabler is installed collect Symmetrix/DMX specific information
- if len(self.policy().package_manager.allPkgsByNameRegex('[Ss][Yy][Mm][Cc][Ll][Ii]-[Ss][Yy][Mm][Cc][Ll][Ii]')) > 0:
+ if len(self.policy().package_manager.all_pkgs_by_name_regex('[Ss][Yy][Mm][Cc][Ll][Ii]-[Ss][Yy][Mm][Cc][Ll][Ii]')) > 0:
print "EMC Solutions Enabler SYMCLI is installed."
print " Gathering EMC Solutions Enabler SYMCLI information..."
- self.addCustomText("EMC Solutions Enabler is installed.<br>")
+ self.add_custom_text("EMC Solutions Enabler is installed.<br>")
self.get_symcli_files()
self.get_symcli_config()
add_about_emc = "yes"
@@ -180,7 +180,7 @@ class emc(Plugin, RedHatPlugin):
if os.path.isdir("/opt/Navisphere/bin"):
print ""
print "The EMC CLARiiON Navisphere Host Agent is installed."
- self.addCustomText("EMC CLARiiON Navisphere Host Agent is installed.<br>")
+ self.add_custom_text("EMC CLARiiON Navisphere Host Agent is installed.<br>")
self.get_navicli_config()
print " Gathering Navisphere NAVICLI Host Agent information..."
print " Please enter a CLARiiON SP IP address. In order to collect"
diff --git a/sos/plugins/filesys.py b/sos/plugins/filesys.py
index ee36bd1d..5409320f 100644
--- a/sos/plugins/filesys.py
+++ b/sos/plugins/filesys.py
@@ -20,11 +20,11 @@ from itertools import *
class filesys(Plugin, RedHatPlugin, UbuntuPlugin):
"""information on filesystems
"""
- optionList = [("lsof", 'gathers information on all open files', 'slow', False)]
- optionList = [("dumpe2fs", 'dump filesystem information', 'slow', False)]
+ option_list = [("lsof", 'gathers information on all open files', 'slow', False)]
+ option_list = [("dumpe2fs", 'dump filesystem information', 'slow', False)]
def setup(self):
- self.addCopySpecs([
+ self.add_copy_specs([
"/proc/filesystems",
"/etc/fstab",
"/proc/self/mounts",
@@ -32,15 +32,15 @@ class filesys(Plugin, RedHatPlugin, UbuntuPlugin):
"/proc/mdstat",
"/etc/raidtab",
"/etc/mdadm.conf"])
- mounts = self.getCmdOutputNow("/bin/mount -l", root_symlink = "mount")
+ mounts = self.get_cmd_output_now("/bin/mount -l", root_symlink = "mount")
- self.addCmdOutput("/bin/findmnt")
- self.addCmdOutput("/bin/df -al", root_symlink = "df")
- self.addCmdOutput("/bin/df -ali")
- if self.getOption('lsof'):
- self.addCmdOutput("/usr/sbin/lsof -b +M -n -l -P", root_symlink = "lsof")
- self.addCmdOutput("/sbin/blkid -c /dev/null")
- self.addCmdOutput("/usr/bin/lsblk")
+ self.add_cmd_output("/bin/findmnt")
+ self.add_cmd_output("/bin/df -al", root_symlink = "df")
+ self.add_cmd_output("/bin/df -ali")
+ if self.get_option('lsof'):
+ self.add_cmd_output("/usr/sbin/lsof -b +M -n -l -P", root_symlink = "lsof")
+ self.add_cmd_output("/sbin/blkid -c /dev/null")
+ self.add_cmd_output("/usr/bin/lsblk")
part_titlep = re.compile("^major")
blankp = re.compile("^$")
@@ -55,7 +55,7 @@ class filesys(Plugin, RedHatPlugin, UbuntuPlugin):
exit(1)
if os.path.exists("/sbin/hdparm"):
for dev in partlist:
- ret, hdparm, time = self.callExtProg('/sbin/hdparm -g %s' %(dev))
+ ret, hdparm, time = self.call_ext_prog('/sbin/hdparm -g %s' %(dev))
if(ret == 0):
start_geo = hdparm.strip().split("\n")[-1].strip().split()[-1]
if(start_geo == "0"):
@@ -69,8 +69,8 @@ class filesys(Plugin, RedHatPlugin, UbuntuPlugin):
devlist.append(dev)
for i in devlist:
- self.addCmdOutput("/sbin/parted -s %s print" % (i))
+ self.add_cmd_output("/sbin/parted -s %s print" % (i))
- if self.getOption('dumpe2fs'):
- for extfs in izip(self.doRegexFindAll(r"^(/dev/.+) on .+ type ext.\s+", mounts)):
- self.addCmdOutput("/sbin/dumpe2fs %s" % (extfs))
+ if self.get_option('dumpe2fs'):
+ for extfs in izip(self.do_regex_find_all(r"^(/dev/.+) on .+ type ext.\s+", mounts)):
+ self.add_cmd_output("/sbin/dumpe2fs %s" % (extfs))
diff --git a/sos/plugins/ftp.py b/sos/plugins/ftp.py
index 61fbfb00..7dc4676d 100644
--- a/sos/plugins/ftp.py
+++ b/sos/plugins/ftp.py
@@ -23,5 +23,5 @@ class ftp(Plugin, RedHatPlugin):
packages = ('vsftpd',)
def setup(self):
- self.addCopySpec("/etc/ftp*")
- self.addCopySpec("/etc/vsftpd")
+ self.add_copy_spec("/etc/ftp*")
+ self.add_copy_spec("/etc/vsftpd")
diff --git a/sos/plugins/gdm.py b/sos/plugins/gdm.py
index a6b3bf2a..45c80f02 100644
--- a/sos/plugins/gdm.py
+++ b/sos/plugins/gdm.py
@@ -18,4 +18,4 @@ class gdm(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""gdm related information
"""
def setup(self):
- self.addCopySpec("/etc/gdm/*")
+ self.add_copy_spec("/etc/gdm/*")
diff --git a/sos/plugins/general.py b/sos/plugins/general.py
index 9979cfec..1ee9c909 100644
--- a/sos/plugins/general.py
+++ b/sos/plugins/general.py
@@ -20,11 +20,11 @@ class General(Plugin):
plugin_name = "general"
- optionList = [("syslogsize", "max size (MiB) to collect per syslog file", "", 15),
+ option_list = [("syslogsize", "max size (MiB) to collect per syslog file", "", 15),
("all_logs", "collect all log files defined in syslog.conf", "", False)]
def setup(self):
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/init", # upstart
"/etc/event.d", # "
"/etc/inittab",
@@ -41,20 +41,20 @@ class General(Plugin):
"/etc/localtime",
"/root/anaconda-ks.cfg"])
- limit = self.getOption("syslogsize")
- self.addCmdOutput("/bin/dmesg", suggest_filename="dmesg_now")
- self.addCopySpecLimit("/var/log/messages*", sizelimit = limit)
- self.addCopySpecLimit("/var/log/secure*", sizelimit = limit)
- self.addCmdOutput("/usr/bin/hostid")
- self.addCmdOutput("/bin/hostname", root_symlink="hostname")
- self.addCmdOutput("/bin/date", root_symlink="date")
- self.addCmdOutput("/usr/bin/uptime", root_symlink="uptime")
- self.addCmdOutput("/bin/dmesg")
- self.addCmdOutput("/usr/sbin/alternatives --display java",
+ limit = self.get_option("syslogsize")
+ self.add_cmd_output("/bin/dmesg", suggest_filename="dmesg_now")
+ self.add_copy_spec_limit("/var/log/messages*", sizelimit = limit)
+ self.add_copy_spec_limit("/var/log/secure*", sizelimit = limit)
+ self.add_cmd_output("/usr/bin/hostid")
+ self.add_cmd_output("/bin/hostname", root_symlink="hostname")
+ self.add_cmd_output("/bin/date", root_symlink="date")
+ self.add_cmd_output("/usr/bin/uptime", root_symlink="uptime")
+ self.add_cmd_output("/bin/dmesg")
+ self.add_cmd_output("/usr/sbin/alternatives --display java",
root_symlink="java")
- self.addCmdOutput("/usr/bin/readlink -f /usr/bin/java")
- self.addCmdOutput("/usr/bin/tree /var/lib")
- self.addCmdOutput("/bin/ls -lR /var/lib")
+ self.add_cmd_output("/usr/bin/readlink -f /usr/bin/java")
+ self.add_cmd_output("/usr/bin/tree /var/lib")
+ self.add_cmd_output("/bin/ls -lR /var/lib")
class RedHatGeneral(General, RedHatPlugin):
@@ -63,30 +63,30 @@ class RedHatGeneral(General, RedHatPlugin):
def setup(self):
super(RedHatGeneral, self).setup()
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/redhat-release",
"/etc/fedora-release",
])
- if self.getOption('all_logs'):
+ if self.get_option('all_logs'):
print "doing all_logs..."
- limit = self.isOptionEnabled("syslogsize")
- logs = self.doRegexFindAll("^\S+\s+(-?\/.*$)\s+",
+ limit = self.option_enabled("syslogsize")
+ logs = self.do_regex_find_all("^\S+\s+(-?\/.*$)\s+",
"/etc/syslog.conf")
print logs
- if self.policy().pkgByName("rsyslog") \
+ if self.policy().pkg_by_name("rsyslog") \
or os.path.exists("/etc/rsyslog.conf"):
- logs += self.doRegexFindAll("^\S+\s+(-?\/.*$)\s+", "/etc/rsyslog.conf")
+ logs += self.do_regex_find_all("^\S+\s+(-?\/.*$)\s+", "/etc/rsyslog.conf")
print logs
for i in logs:
if i.startswith("-"):
i = i[1:]
if os.path.isfile(i):
- self.addCopySpecLimit(i, sizelimit = limit)
+ self.add_copy_spec_limit(i, sizelimit = limit)
def postproc(self):
- self.doFileSub("/etc/sysconfig/rhn/up2date",
+ self.do_file_sub("/etc/sysconfig/rhn/up2date",
r"(\s*proxyPassword\s*=\s*)\S+", r"\1***")
@@ -95,7 +95,7 @@ class DebianGeneral(General, DebianPlugin):
def setup(self):
super(DebianGeneral, self).setup()
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/debian_version",
"/etc/default",
"/var/log/up2date",
@@ -106,7 +106,7 @@ class UbuntuGeneral(General, UbuntuPlugin):
def setup(self):
super(UbuntuGeneral, self).setup()
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/os-release",
"/var/log/ufw.log",
"/var/log/apport.log",
@@ -122,4 +122,4 @@ class UbuntuGeneral(General, UbuntuPlugin):
"/var/log/unattended-upgrades",
"/var/log/upstart"
])
- self.addCmdOutput("/usr/sbin/ufw app list",root_symlink="ufw")
+ self.add_cmd_output("/usr/sbin/ufw app list",root_symlink="ufw")
diff --git a/sos/plugins/gluster.py b/sos/plugins/gluster.py
index 0ce1295e..6383938b 100644
--- a/sos/plugins/gluster.py
+++ b/sos/plugins/gluster.py
@@ -25,7 +25,7 @@ class gluster(Plugin, RedHatPlugin):
packages = ["glusterfs", "glusterfs-core"]
files = ["/etc/glusterd", "/var/lib/glusterd"]
- def defaultenabled(self):
+ def default_enabled(self):
return True
def get_volume_names(self, volume_file):
@@ -76,12 +76,12 @@ class gluster(Plugin, RedHatPlugin):
pass
def setup(self):
- self.addCmdOutput("/usr/sbin/gluster peer status")
+ self.add_cmd_output("/usr/sbin/gluster peer status")
# check package version handling rename of glusterfs-core -> glusterfs
- pkg = self.policy().pkgByName("glusterfs-core");
+ pkg = self.policy().pkg_by_name("glusterfs-core");
if not pkg:
- pkg = self.policy().pkgByName("glusterfs");
+ pkg = self.policy().pkg_by_name("glusterfs");
# need to handle "no package" case for users who enable with -e/-o
if not pkg:
return
@@ -89,32 +89,32 @@ class gluster(Plugin, RedHatPlugin):
gluster_major = int((pkg["version"])[:1])
gluster_minor = int((pkg["version"])[2:3])
if (gluster_major == 3) and (gluster_minor <= 2):
- self.addCopySpec("/etc/glusterd/")
- self.addForbiddenPath("/etc/glusterd/geo-replication/secret.pem")
+ self.add_copy_spec("/etc/glusterd/")
+ self.add_forbidden_path("/etc/glusterd/geo-replication/secret.pem")
else:
- self.addCopySpec("/var/lib/glusterd/")
- self.addForbiddenPath("/var/lib/glusterd/geo-replication/secret.pem")
+ self.add_copy_spec("/var/lib/glusterd/")
+ self.add_forbidden_path("/var/lib/glusterd/geo-replication/secret.pem")
# collect unified file and object storage configuration
- self.addCopySpec("/etc/swift/")
+ self.add_copy_spec("/etc/swift/")
# glusterfs-server rpm scripts stash this on migration to 3.3.x
- self.addCopySpec("/etc/glusterd.rpmsave")
+ self.add_copy_spec("/etc/glusterd.rpmsave")
# common to all versions
- self.addCopySpec("/etc/glusterfs")
+ self.add_copy_spec("/etc/glusterfs")
self.make_preparations(self.statedump_dir)
- #self.addCmdOutput("killall -USR1 glusterfs glusterfsd")
+ #self.add_cmd_output("killall -USR1 glusterfs glusterfsd")
os.system("killall -USR1 glusterfs glusterfsd");
# let all the processes catch the signal and create statedump file
# entries.
time.sleep(1)
self.wait_for_statedump(self.statedump_dir)
- self.addCopySpec('/tmp/glusterdump.options')
- self.addCopySpec(self.statedump_dir)
+ self.add_copy_spec('/tmp/glusterdump.options')
+ self.add_copy_spec(self.statedump_dir)
- self.addCmdOutput("gluster volume status")
+ self.add_cmd_output("gluster volume status")
# collect this last as some of the other actions create log entries
- self.addCopySpec("/var/log/glusterfs")
+ self.add_copy_spec("/var/log/glusterfs")
diff --git a/sos/plugins/hardware.py b/sos/plugins/hardware.py
index 0c420705..ef6359ff 100644
--- a/sos/plugins/hardware.py
+++ b/sos/plugins/hardware.py
@@ -23,7 +23,7 @@ class hardware(Plugin):
plugin_name = "hardware"
def setup(self):
- self.addCopySpecs([
+ self.add_copy_specs([
"/proc/partitions",
"/proc/cpuinfo",
"/proc/meminfo",
@@ -45,31 +45,31 @@ class hardware(Plugin):
"/sys/state",
"/sys/firmware/acpi/tables",
"/var/log/mcelog"])
- self.addCmdOutput("""/bin/echo -e "lspci:\n" ; /sbin/lspci ; /bin/echo -e "\nlspci -nvv:\n" ; /sbin/lspci -nvv ; /bin/echo -e "\nlspci -tv:\n" ; /sbin/lspci -tv""", suggest_filename = "lspci", root_symlink = "lspci")
+ self.add_cmd_output("""/bin/echo -e "lspci:\n" ; /sbin/lspci ; /bin/echo -e "\nlspci -nvv:\n" ; /sbin/lspci -nvv ; /bin/echo -e "\nlspci -tv:\n" ; /sbin/lspci -tv""", suggest_filename = "lspci", root_symlink = "lspci")
- self.addCmdOutput("/usr/sbin/dmidecode", root_symlink = "dmidecode")
+ self.add_cmd_output("/usr/sbin/dmidecode", root_symlink = "dmidecode")
if os.path.exists("/usr/bin/cpufreq-info"):
- self.addCmdOutput("/usr/bin/cpufreq-info")
+ self.add_cmd_output("/usr/bin/cpufreq-info")
if os.path.exists("/usr/bin/cpupower"):
- self.addCmdOutput("/usr/bin/cpupower info")
- self.addCmdOutput("/usr/bin/cpupower frequency-info")
+ self.add_cmd_output("/usr/bin/cpupower info")
+ self.add_cmd_output("/usr/bin/cpupower frequency-info")
- if self.policy().getArch().endswith("386"):
- self.addCmdOutput("/usr/sbin/x86info -a")
+ if self.policy().get_arch().endswith("386"):
+ self.add_cmd_output("/usr/sbin/x86info -a")
if os.path.exists("/usr/bin/lsusb"):
lsusb_path = "/usr/bin/lsusb"
else:
lsusb_path = "/usr/bin/lsusb"
- self.addCmdOutput("%s"% lsusb_path)
- self.addCmdOutput("%s -v"% lsusb_path)
- self.addCmdOutput("%s -t"% lsusb_path)
+ self.add_cmd_output("%s"% lsusb_path)
+ self.add_cmd_output("%s -v"% lsusb_path)
+ self.add_cmd_output("%s -t"% lsusb_path)
- self.addCmdOutput("/usr/bin/lshal")
- self.addCmdOutput("/usr/bin/systool -c fc_host -v")
- self.addCmdOutput("/usr/bin/systool -c scsi_host -v")
+ self.add_cmd_output("/usr/bin/lshal")
+ self.add_cmd_output("/usr/bin/systool -c fc_host -v")
+ self.add_cmd_output("/usr/bin/systool -c scsi_host -v")
class RedHatHardware(hardware, RedHatPlugin):
"""hardware related information for Red Hat distribution
@@ -80,7 +80,7 @@ class RedHatHardware(hardware, RedHatPlugin):
hwpaths = glob("/usr/share/rhn/up2date*client/hardware.py")
if (len(hwpaths) == 0):
return
- self.addCmdOutput(hwpaths[0])
+ self.add_cmd_output(hwpaths[0])
class DebianHardware(hardware, DebianPlugin, UbuntuPlugin):
diff --git a/sos/plugins/hts.py b/sos/plugins/hts.py
index 7ab9cac7..689f7be2 100644
--- a/sos/plugins/hts.py
+++ b/sos/plugins/hts.py
@@ -18,5 +18,5 @@ class hts(Plugin, RedHatPlugin):
"""Red Hat Hardware Test Suite related information
"""
def setup(self):
- self.addCopySpec("/etc/httpd/conf.d/hts.conf")
- self.addCopySpec("/var/hts")
+ self.add_copy_spec("/etc/httpd/conf.d/hts.conf")
+ self.add_copy_spec("/var/hts")
diff --git a/sos/plugins/i18n.py b/sos/plugins/i18n.py
index 00c992c9..a8a09c7c 100644
--- a/sos/plugins/i18n.py
+++ b/sos/plugins/i18n.py
@@ -18,5 +18,5 @@ class i18n(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""i18n related information
"""
def setup(self):
- self.addCopySpecs(["/etc/X11/xinit/xinput.d/*", "/etc/locale.conf"])
- self.addCmdOutput("/usr/bin/locale")
+ self.add_copy_specs(["/etc/X11/xinit/xinput.d/*", "/etc/locale.conf"])
+ self.add_cmd_output("/usr/bin/locale")
diff --git a/sos/plugins/infiniband.py b/sos/plugins/infiniband.py
index 876ae5fb..59cc5078 100644
--- a/sos/plugins/infiniband.py
+++ b/sos/plugins/infiniband.py
@@ -20,20 +20,20 @@ class infiniband(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Infiniband related information
"""
- def checkenabled(self):
- if self.cInfo["policy"].pkgByName("libibverbs-utils"):
+ def check_enabled(self):
+ if self.commons["policy"].pkg_by_name("libibverbs-utils"):
return True
return False
def setup(self):
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/ofed/openib.conf",
"/etc/ofed/opensm.conf"])
- self.addCmdOutput("/usr/bin/ibv_devices")
- self.addCmdOutput("/usr/bin/ibv_devinfo")
- self.addCmdOutput("/usr/sbin/ibstat")
- self.addCmdOutput("/usr/sbin/ibstatus")
- self.addCmdOutput("/usr/sbin/ibhosts")
+ self.add_cmd_output("/usr/bin/ibv_devices")
+ self.add_cmd_output("/usr/bin/ibv_devinfo")
+ self.add_cmd_output("/usr/sbin/ibstat")
+ self.add_cmd_output("/usr/sbin/ibstatus")
+ self.add_cmd_output("/usr/sbin/ibhosts")
return
diff --git a/sos/plugins/initrd.py b/sos/plugins/initrd.py
index 324d642d..ef6b6225 100644
--- a/sos/plugins/initrd.py
+++ b/sos/plugins/initrd.py
@@ -20,8 +20,8 @@ class initrd(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""
def setup(self):
for initrd in glob('/boot/initrd-*.img'):
- self.addCmdOutput("/bin/zcat "+initrd+" | /bin/cpio "+
+ self.add_cmd_output("/bin/zcat "+initrd+" | /bin/cpio "+
"--extract --to-stdout init" )
- def defaultenabled(self):
+ def default_enabled(self):
return False
diff --git a/sos/plugins/ipa.py b/sos/plugins/ipa.py
index 93f02f70..293ebe28 100644
--- a/sos/plugins/ipa.py
+++ b/sos/plugins/ipa.py
@@ -27,19 +27,19 @@ class ipa(Plugin, RedHatPlugin):
files = ('/etc/ipa',)
packages = ('ipa-server', 'ipa-client')
- def checkenabled(self):
- self.ipa_server = self.isInstalled("ipa-server")
- self.ipa_client = self.isInstalled("ipa-client")
- return Plugin.checkenabled(self)
+ def check_enabled(self):
+ self.ipa_server = self.is_installed("ipa-server")
+ self.ipa_client = self.is_installed("ipa-client")
+ return Plugin.check_enabled(self)
def setup(self):
if self.ipa_server:
- self.addCopySpec("/var/log/ipaserver-install.log")
- self.addCopySpec("/var/log/ipareplica-install.log")
+ self.add_copy_spec("/var/log/ipaserver-install.log")
+ self.add_copy_spec("/var/log/ipareplica-install.log")
if self.ipa_client:
- self.addCopySpec("/var/log/ipaclient-install.log")
+ self.add_copy_spec("/var/log/ipaclient-install.log")
- self.addCopySpecs(["/var/log/ipaupgrade.log",
+ self.add_copy_specs(["/var/log/ipaupgrade.log",
"/var/log/krb5kdc.log",
"/var/log/pki-ca/debug",
"/var/log/pki-ca/catalina.out",
@@ -52,32 +52,32 @@ class ipa(Plugin, RedHatPlugin):
"/etc/hosts",
"/etc/named.*"])
- self.addForbiddenPath("/etc/pki/nssdb/key*")
- self.addForbiddenPath("/etc/pki-ca/flatfile.txt")
- self.addForbiddenPath("/etc/pki-ca/password.conf")
- self.addForbiddenPath("/var/lib/pki-ca/alias/key*")
+ self.add_forbidden_path("/etc/pki/nssdb/key*")
+ self.add_forbidden_path("/etc/pki-ca/flatfile.txt")
+ self.add_forbidden_path("/etc/pki-ca/password.conf")
+ self.add_forbidden_path("/var/lib/pki-ca/alias/key*")
- self.addForbiddenPath("/etc/dirsrv/slapd-*/key*")
- self.addForbiddenPath("/etc/dirsrv/slapd-*/pin.txt")
- self.addForbiddenPath("/etc/dirsrv/slapd-*/pwdfile.txt")
+ self.add_forbidden_path("/etc/dirsrv/slapd-*/key*")
+ self.add_forbidden_path("/etc/dirsrv/slapd-*/pin.txt")
+ self.add_forbidden_path("/etc/dirsrv/slapd-*/pwdfile.txt")
- self.addForbiddenPath("/etc/named.keytab")
+ self.add_forbidden_path("/etc/named.keytab")
- self.addCmdOutput("ls -la /etc/dirsrv/slapd-*/schema/")
+ self.add_cmd_output("ls -la /etc/dirsrv/slapd-*/schema/")
- self.addCmdOutput("ipa-getcert list")
+ self.add_cmd_output("ipa-getcert list")
- self.addCmdOutput("certutil -L -d /etc/httpd/alias/")
- self.addCmdOutput("certutil -L -d /etc/dirsrv/slapd-*/")
+ self.add_cmd_output("certutil -L -d /etc/httpd/alias/")
+ self.add_cmd_output("certutil -L -d /etc/dirsrv/slapd-*/")
- self.addCmdOutput("klist -ket /etc/dirsrv/ds.keytab")
- self.addCmdOutput("klist -ket /etc/httpd/conf/ipa.keytab")
- self.addCmdOutput("klist -ket /etc/krb5.keytab")
+ self.add_cmd_output("klist -ket /etc/dirsrv/ds.keytab")
+ self.add_cmd_output("klist -ket /etc/httpd/conf/ipa.keytab")
+ self.add_cmd_output("klist -ket /etc/krb5.keytab")
return
def postproc(self):
match = r"(\s*arg \"password )[^\"]*"
subst = r"\1********"
- self.doFileSub("/etc/named.conf", match, subst)
+ self.do_file_sub("/etc/named.conf", match, subst)
diff --git a/sos/plugins/ipsec.py b/sos/plugins/ipsec.py
index 67923801..4cfba6c0 100644
--- a/sos/plugins/ipsec.py
+++ b/sos/plugins/ipsec.py
@@ -30,7 +30,7 @@ class RedHatIpsec(ipsec, RedHatPlugin):
files = ('/etc/racoon/racoon.conf',)
def setup(self):
- self.addCopySpec("/etc/racoon")
+ self.add_copy_spec("/etc/racoon")
class DebianIpsec(ipsec, DebianPlugin, UbuntuPlugin):
"""ipsec related information for Debian distributions
@@ -39,6 +39,6 @@ class DebianIpsec(ipsec, DebianPlugin, UbuntuPlugin):
files = ('/etc/ipsec-tools.conf',)
def setup(self):
- self.addCopySpecs(["/etc/ipsec-tools.conf",
+ self.add_copy_specs(["/etc/ipsec-tools.conf",
"/etc/ipsec-tools.d",
"/etc/default/setkey"])
diff --git a/sos/plugins/iscsi.py b/sos/plugins/iscsi.py
index 28f93dd5..3d5423b8 100644
--- a/sos/plugins/iscsi.py
+++ b/sos/plugins/iscsi.py
@@ -29,11 +29,11 @@ class RedHatIscsi(iscsi, RedHatPlugin):
def setup(self):
super(RedHatIscsi, self).setup()
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/iscsi/iscsid.conf",
"/etc/iscsi/initiatorname.iscsi",
"/var/lib/iscsi"])
- self.addCmdOutput("iscsiadm -m session -P 3")
- self.addCmdOutput("iscsiadm -m node -P 3")
- self.addCmdOutput("iscsiadm -m iface -P 1")
- self.addCmdOutput("iscsiadm -m node --op=show")
+ self.add_cmd_output("iscsiadm -m session -P 3")
+ self.add_cmd_output("iscsiadm -m node -P 3")
+ self.add_cmd_output("iscsiadm -m iface -P 1")
+ self.add_cmd_output("iscsiadm -m node --op=show")
diff --git a/sos/plugins/iscsitarget.py b/sos/plugins/iscsitarget.py
index aa6fa37a..284fe36b 100644
--- a/sos/plugins/iscsitarget.py
+++ b/sos/plugins/iscsitarget.py
@@ -30,8 +30,8 @@ class RedHatIscsiTarget(Plugin, RedHatPlugin):
packages = ('scsi-target-utils',)
def setup(self):
- self.addCopySpec("/etc/tgt/targets.conf")
- self.addCmdOutput("tgtadm --lld iscsi --op show --mode target")
+ self.add_copy_spec("/etc/tgt/targets.conf")
+ self.add_cmd_output("tgtadm --lld iscsi --op show --mode target")
class DebianIscsiTarget(iscsitarget, DebianPlugin, UbuntuPlugin):
"""iscsi-target related information for Debian based distributions
@@ -41,7 +41,7 @@ class DebianIscsiTarget(iscsitarget, DebianPlugin, UbuntuPlugin):
def setup(self):
super(DebianIscsi, self).setup()
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/iet",
"/etc/sysctl.d/30-iscsitarget.conf",
"/etc/default/iscsitarget"
diff --git a/sos/plugins/jboss.py b/sos/plugins/jboss.py
index e5283a5c..f36ba1d0 100644
--- a/sos/plugins/jboss.py
+++ b/sos/plugins/jboss.py
@@ -14,7 +14,7 @@ class jboss(Plugin, RedHatPlugin):
"""JBoss related information
"""
- optionList = [("home", 'JBoss\'s installation dir (i.e. JBOSS_HOME)', '', False),
+ option_list = [("home", 'JBoss\'s installation dir (i.e. JBOSS_HOME)', '', False),
("javahome", 'Java\'s installation dir (i.e. JAVA_HOME)', '', False),
("profile", 'Quoted and space separated list of server profiles to limit collection. \
Default=\'all default minimal production standard web\'.', '', False),
@@ -41,17 +41,17 @@ Default=\'all default minimal production standard web\'.', '', False),
Returns:
True JBOSS_HOME is set and the path exists. False otherwise.
"""
- if self.getOption("home"):
+ if self.get_option("home"):
## Prefer this value first over the ENV
- self.__jbossHome=self.getOption("home")
- self.addAlert("INFO: The JBoss installation directory supplied to SOS is " +
+ self.__jbossHome=self.get_option("home")
+ self.add_alert("INFO: The JBoss installation directory supplied to SOS is " +
self.__jbossHome)
elif os.environ.get("JBOSS_HOME"):
self.__jbossHome=os.environ.get("JBOSS_HOME")
- self.addAlert("INFO: The JBoss installation directory (i.e. JBOSS_HOME) from the environment is " +
+ self.add_alert("INFO: The JBoss installation directory (i.e. JBOSS_HOME) from the environment is " +
self.__jbossHome)
else:
- self.addAlert("ERROR: The JBoss installation directory was not supplied.\
+ self.add_alert("ERROR: The JBoss installation directory was not supplied.\
The JBoss SOS plug-in cannot continue.")
return False
@@ -62,13 +62,13 @@ Default=\'all default minimal production standard web\'.', '', False),
if os.path.exists(tmp):
jbossClasspath=tmp + os.sep + "*" + os.pathsep
else:
- self.addAlert("WARN: The JBoss lib directory does not exist. Dir(%s) " % tmp)
+ self.add_alert("WARN: The JBoss lib directory does not exist. Dir(%s) " % tmp)
tmp=os.path.join(self.__jbossHome, "common" , "lib")
if os.path.exists(tmp):
jbossClasspath+=tmp + os.sep + "*"
else:
- self.addAlert("WARN: The JBoss lib directory does not exist. Dir(%s) " % tmp)
+ self.add_alert("WARN: The JBoss lib directory does not exist. Dir(%s) " % tmp)
os.environ['JBOSS_CLASSPATH']=jbossClasspath
@@ -76,7 +76,7 @@ Default=\'all default minimal production standard web\'.', '', False),
else:
msg = "ERROR: The path to the JBoss installation directory does not exist. Path is: " + self.__jbossHome
print msg
- self.addAlert(msg)
+ self.add_alert(msg)
return False
def __getJavaHome(self):
@@ -89,23 +89,23 @@ Default=\'all default minimal production standard web\'.', '', False),
javaHome=None
java="bin/java"
- if self.getOption("javahome"):
+ if self.get_option("javahome"):
## Prefer this value first over the ENV
- javaHome=self.getOption("javahome")
- self.addAlert("INFO: The Java installation directory supplied to SOS is " +
+ javaHome=self.get_option("javahome")
+ self.add_alert("INFO: The Java installation directory supplied to SOS is " +
javaHome)
elif os.environ.get("JAVA_HOME"):
javaHome=os.environ.get("JAVA_HOME")
- self.addAlert("INFO: The Java installation directory (i.e. JAVA_HOME) from the environment is " +
+ self.add_alert("INFO: The Java installation directory (i.e. JAVA_HOME) from the environment is " +
javaHome)
else:
## Test to see if Java is already in the PATH
- (status, output, rtime) = self.callExtProg("java -version")
+ (status, output, rtime) = self.call_ext_prog("java -version")
if (status == 0):
- self.addAlert("INFO: The Java installation directory is in the system path.")
+ self.add_alert("INFO: The Java installation directory is in the system path.")
return True
else:
- self.addAlert("ERROR: The Java installation directory was not supplied.\
+ self.add_alert("ERROR: The Java installation directory was not supplied.\
The JBoss SOS plug-in will not collect twiddle data.")
return False
@@ -119,7 +119,7 @@ Default=\'all default minimal production standard web\'.', '', False),
else:
msg = "ERROR: The path to the Java installation directory does not exist. Path is: %s" % (javaHome)
print msg
- self.addAlert(msg)
+ self.add_alert(msg)
return False
@@ -133,10 +133,10 @@ Default=\'all default minimal production standard web\'.', '', False),
credential = None
## Let's make a best effort not to pass expansions or escapes to the shell
## by strong quoting the user's input
- if self.getOption("user"):
- credential=" -u '" + self.getOption("user") + "' "
- if self.getOption("pass"):
- credential+=" -p '" + self.getOption("pass") + "' "
+ if self.get_option("user"):
+ credential=" -u '" + self.get_option("user") + "' "
+ if self.get_option("pass"):
+ credential+=" -p '" + self.get_option("pass") + "' "
else:
credential=None
return credential
@@ -151,9 +151,9 @@ Default=\'all default minimal production standard web\'.', '', False),
Nothing. Will update __jbossServerConfigDirs if the user
supplied a limited list.
"""
- if self.getOption("profile"):
- profiles=self.getOption("profile")
- ## I'd rather use comma as the delimiter but getOption doesn't seem to be passing it through.
+ if self.get_option("profile"):
+ profiles=self.get_option("profile")
+ ## I'd rather use comma as the delimiter but get_option doesn't seem to be passing it through.
## Since we are using spaces as the delimiter, we need to filter out empty list elements
## if the user did something like ' all default web '.
profiles=profiles.split(' ')
@@ -179,14 +179,14 @@ Default=\'all default minimal production standard web\'.', '', False),
self.__twiddleCmd += credential
else:
## Reset twiddlecmd to None
- self.addAlert("ERROR: The twiddle program could not be found. Program=%s" % (self.__twiddleCmd))
+ self.add_alert("ERROR: The twiddle program could not be found. Program=%s" % (self.__twiddleCmd))
self.__twiddleCmd = None
return
def __createHTMLBodyStart(self):
"""
- The free-form HTML that can be inserted into the SOS report with addCustomText is within
+ The free-form HTML that can be inserted into the SOS report with add_custom_text is within
a <p> block. We need to add a few pieces of HTML so that all of our subsequent data will
be rendered properly.
"""
@@ -253,7 +253,7 @@ Default=\'all default minimal production standard web\'.', '', False),
except IOError, ioe:
msg = "ERROR: Unable to open %s for reading. Error: " % (file,ioe)
print msg
- self.addAlert(msg)
+ self.add_alert(msg)
md5 = hashlib.md5()
data = fd.read(self.__MD5_CHUNK_SIZE)
@@ -272,7 +272,7 @@ Default=\'all default minimal production standard web\'.', '', False),
else:
msg = "ERROR: Unable to compute md5sum of %s. Msg (%s)" % (file, result[1])
print msg
- self.addAlert(msg)
+ self.add_alert(msg)
return retVal
@@ -290,12 +290,12 @@ Default=\'all default minimal production standard web\'.', '', False),
except Exception, e:
msg="ERROR: reading manifest from %s. Error: %s" % (jarFile, e)
print msg
- self.addAlert(msg)
+ self.add_alert(msg)
zf.close()
except Exception, e:
msg="ERROR: reading contents of %s. Error: %s" % (jarFile, e)
print msg
- self.addAlert(msg)
+ self.add_alert(msg)
return manifest
def __getStdJarInfo(self):
@@ -343,13 +343,13 @@ Default=\'all default minimal production standard web\'.', '', False),
self.__getManifest(jarFile))
if not found:
- self.addAlert("WARN: No jars found in JBoss system path (" + path + ").")
+ self.add_alert("WARN: No jars found in JBoss system path (" + path + ").")
self.__jbossHTMLBody += """
</ul>
</div>
"""
else:
- self.addAlert("ERROR: JBoss system path (" + path + ") does not exist.")
+ self.add_alert("ERROR: JBoss system path (" + path + ") does not exist.")
return
def __getServerConfigJarInfo(self, configDirAry):
@@ -398,14 +398,14 @@ Default=\'all default minimal production standard web\'.', '', False),
self.__getManifest(jarFile))
if not found:
- self.addAlert("WARN: No jars found in the JBoss server configuration (%s)." % (path))
+ self.add_alert("WARN: No jars found in the JBoss server configuration (%s)." % (path))
self.__jbossHTMLBody += """
</ul>
</div>
"""
else:
- self.addAlert("ERROR: JBoss server configuration path (" + path + ") does not exist.")
+ self.add_alert("ERROR: JBoss server configuration path (" + path + ") does not exist.")
return
@@ -607,29 +607,29 @@ Default=\'all default minimal production standard web\'.', '', False),
for dir in configDirAry:
path=os.path.join(self.__jbossHome, "server", dir)
## First add forbidden files
- self.addForbiddenPath(os.path.join(path, "tmp"))
- self.addForbiddenPath(os.path.join(path, "work"))
- self.addForbiddenPath(os.path.join(path, "data"))
+ self.add_forbidden_path(os.path.join(path, "tmp"))
+ self.add_forbidden_path(os.path.join(path, "work"))
+ self.add_forbidden_path(os.path.join(path, "data"))
if os.path.exists(path):
## First get everything in the conf dir
confDir=os.path.join(path, "conf")
- self.doCopyFileOrDir(confDir)
+ self.do_copy_file_or_dir(confDir)
## Log dir next
logDir=os.path.join(path, "log")
for logFile in find("*", logDir):
- self.addCopySpecLimit(logFile, self.getOption("logsize"))
+ self.add_copy_spec_limit(logFile, self.get_option("logsize"))
## Deploy dir
deployDir=os.path.join(path, "deploy")
for deployFile in find("*", deployDir, max_depth=1):
- self.addCopySpec(deployFile)
+ self.add_copy_spec(deployFile)
## Get application deployment descriptors if designated.
- if self.isOptionEnabled("appxml"):
- appxml=self.getOption("appxml")
- ## I'd rather use comma as the delimiter but getOption doesn't seem to be passing it through.
+ if self.option_enabled("appxml"):
+ appxml=self.get_option("appxml")
+ ## I'd rather use comma as the delimiter but get_option doesn't seem to be passing it through.
## Since we are using spaces as the delimiter, we need to filter out empty list elements
## if the user did something like ' all default web '.
appxml=appxml.split(' ')
@@ -638,10 +638,10 @@ Default=\'all default minimal production standard web\'.', '', False),
for app in appxml:
pat = os.path.join("*%s*" % (app,), "WEB-INF")
for file in find("*.xml", deployDir, path_pattern=pat):
- self.addCopySpec(file)
+ self.add_copy_spec(file)
return
- def checkenabled(self):
+ def check_enabled(self):
if not self.__getJbossHome():
return False
return True
@@ -661,17 +661,17 @@ Default=\'all default minimal production standard web\'.', '', False),
self.__createHTMLBodyStart()
## Generate hashes of the stock Jar files for the report.
- if self.getOption("stdjar"):
+ if self.get_option("stdjar"):
self.__getStdJarInfo()
## Generate hashes for the Jars in the various profiles
- if self.getOption("servjar"):
+ if self.get_option("servjar"):
self.__getServerConfigJarInfo(self.__jbossServerConfigDirs)
## Generate a Tree for JBOSS_HOME
self.__getJBossHomeTree()
- if self.getOption("twiddle"):
+ if self.get_option("twiddle"):
## We need to know where Java is installed or at least ensure that it
## is available to the plug-in so that we can run twiddle.
self.__haveJava = self.__getJavaHome()
@@ -679,7 +679,7 @@ Default=\'all default minimal production standard web\'.', '', False),
self.__getTwiddleData()
- self.addCustomText(self.__jbossHTMLBody)
+ self.add_custom_text(self.__jbossHTMLBody)
self.__getFiles(self.__jbossServerConfigDirs)
@@ -694,20 +694,20 @@ Default=\'all default minimal production standard web\'.', '', False),
path=os.path.join(self.__jbossHome, "server", dir)
## Really annoying that there appears to be no vehicle to
## say I want ignore case...argh!
- self.doFileSub(os.path.join(path,"conf","login-config.xml"),
+ self.do_file_sub(os.path.join(path,"conf","login-config.xml"),
r"\"[Pp][Aa][Ss][Ss][Ww][Oo][Rr][Dd]\".*>.*</[Mm][Oo][Dd][Uu][Ll][Ee]-[Oo][Pp][Tt][Ii][Oo][Nn].*>",
r'"password">********</module-option>')
tmp = os.path.join(path,"conf", "props")
for propFile in find("*-users.properties", tmp):
- self.doFileSub(propFile,
+ self.do_file_sub(propFile,
r"=(.*)",
r'=********')
## Remove PW from -ds.xml files
tmp=os.path.join(path, "deploy")
for dsFile in find("*-ds.xml", tmp):
- self.doFileSub(dsFile,
+ self.do_file_sub(dsFile,
r"<[Pp][Aa][Ss][Ss][Ww][Oo][Rr][Dd].*>.*</[Pp][Aa][Ss][Ss][Ww][Oo][Rr][Dd].*>",
r"<password>********</password>")
return
diff --git a/sos/plugins/juju.py b/sos/plugins/juju.py
index 4a6450ba..df79185e 100644
--- a/sos/plugins/juju.py
+++ b/sos/plugins/juju.py
@@ -20,5 +20,5 @@ class juju(Plugin, UbuntuPlugin):
""" Juju Plugin
"""
def setup(self):
- self.addCopySpecs(["/var/log/juju",
+ self.add_copy_specs(["/var/log/juju",
"/var/lib/juju"])
diff --git a/sos/plugins/kdump.py b/sos/plugins/kdump.py
index 51948c8c..6cd7e89d 100644
--- a/sos/plugins/kdump.py
+++ b/sos/plugins/kdump.py
@@ -22,7 +22,7 @@ class kdump(Plugin):
plugin_name = "kdump"
def setup(self):
- self.addCopySpecs([
+ self.add_copy_specs([
"/proc/cmdline"
])
@@ -34,7 +34,7 @@ class RedHatKdump(kdump, RedHatPlugin):
packages = ('kexec-tools',)
def setup(self):
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/kdump.conf",
"/etc/udev/rules.d/*kexec.rules"])
@@ -46,6 +46,6 @@ class DebianKdump(kdump, DebianPlugin, UbuntuPlugin):
packages = ('kdump-tools',)
def setup(self):
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/default/kdump-tools"
])
diff --git a/sos/plugins/kernel.py b/sos/plugins/kernel.py
index 08ebb693..2922d123 100644
--- a/sos/plugins/kernel.py
+++ b/sos/plugins/kernel.py
@@ -18,26 +18,26 @@ import os, re
class kernel(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""kernel related information
"""
- optionList = [("modinfo", 'gathers information on all kernel modules', 'fast', True)]
- moduleFile = ""
+ option_list = [("modinfo", 'gathers information on all kernel modules', 'fast', True)]
+ module_file = ""
def setup(self):
- self.addCmdOutput("/bin/uname -a", root_symlink = "uname")
- self.moduleFile = self.getCmdOutputNow("/sbin/lsmod", root_symlink = "lsmod")
+ self.add_cmd_output("/bin/uname -a", root_symlink = "uname")
+ self.module_file = self.get_cmd_output_now("/sbin/lsmod", root_symlink = "lsmod")
- if self.getOption('modinfo'):
+ if self.get_option('modinfo'):
runcmd = ""
- ret, mods, rtime = self.callExtProg('/sbin/lsmod | /bin/cut -f1 -d" " 2>/dev/null | /bin/grep -v Module 2>/dev/null')
+ ret, mods, rtime = self.call_ext_prog('/sbin/lsmod | /bin/cut -f1 -d" " 2>/dev/null | /bin/grep -v Module 2>/dev/null')
for kmod in mods.split('\n'):
if '' != kmod.strip():
runcmd = runcmd + " " + kmod
if len(runcmd):
- self.addCmdOutput("/sbin/modinfo " + runcmd)
+ self.add_cmd_output("/sbin/modinfo " + runcmd)
- self.addCmdOutput("/sbin/sysctl -a")
+ self.add_cmd_output("/sbin/sysctl -a")
if os.path.isfile("/sbin/ksyms"):
- self.addCmdOutput("/sbin/ksyms")
- self.addCopySpecs([
+ self.add_cmd_output("/sbin/ksyms")
+ self.add_copy_specs([
"/proc/sys/kernel/random/boot_id",
"/sys/module/*/parameters",
"/sys/module/*/initstate",
@@ -46,7 +46,7 @@ class kernel(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"/proc/filesystems",
"/proc/ksyms",
"/proc/slabinfo",
- "/lib/modules/%s/modules.dep" % self.policy().kernelVersion(),
+ "/lib/modules/%s/modules.dep" % self.policy().kernel_version(),
"/etc/conf.modules",
"/etc/modules.conf",
"/etc/modprobe.conf",
@@ -63,4 +63,4 @@ class kernel(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"/proc/timer*",
"/proc/lock*"])
- self.addCmdOutput("/usr/sbin/dkms status")
+ self.add_cmd_output("/usr/sbin/dkms status")
diff --git a/sos/plugins/kernelrt.py b/sos/plugins/kernelrt.py
index a0e1e6d7..a03d7e08 100644
--- a/sos/plugins/kernelrt.py
+++ b/sos/plugins/kernelrt.py
@@ -25,11 +25,11 @@ class kernel_rt(Plugin, RedHatPlugin):
files = ('/sys/kernel/realtime',)
def setup(self):
- self.addCopySpec('/etc/rtgroups')
- self.addCopySpec('/proc/sys/kernel/sched_rt_period_us')
- self.addCopySpec('/proc/sys/kernel/sched_rt_runtime_us')
- self.addCopySpec('/sys/kernel/realtime')
- self.addCopySpec('/sys/devices/system/clocksource/clocksource0/available_clocksource')
- self.addCopySpec('/sys/devices/system/clocksource/clocksource0/current_clocksource')
- if self.isInstalled('tuna'):
- self.addCmdOutput('/usr/bin/tuna -CP | /ust/bin/head -20')
+ self.add_copy_spec('/etc/rtgroups')
+ self.add_copy_spec('/proc/sys/kernel/sched_rt_period_us')
+ self.add_copy_spec('/proc/sys/kernel/sched_rt_runtime_us')
+ self.add_copy_spec('/sys/kernel/realtime')
+ self.add_copy_spec('/sys/devices/system/clocksource/clocksource0/available_clocksource')
+ self.add_copy_spec('/sys/devices/system/clocksource/clocksource0/current_clocksource')
+ if self.is_installed('tuna'):
+ self.add_cmd_output('/usr/bin/tuna -CP | /ust/bin/head -20')
diff --git a/sos/plugins/kvm.py b/sos/plugins/kvm.py
index d7ad26f8..dbc94033 100644
--- a/sos/plugins/kvm.py
+++ b/sos/plugins/kvm.py
@@ -22,9 +22,9 @@ class kvm(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""KVM related information
"""
- optionList = [("topOutput", '5x iterations of top data', 'slow', False)]
+ option_list = [("topOutput", '5x iterations of top data', 'slow', False)]
- def checkenabled(self):
+ def check_enabled(self):
return os.access("/sys/module/kvm", os.R_OK)
def setup(self):
@@ -33,13 +33,13 @@ class kvm(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
os.popen("mount -t debugfs debugfs /sys/kernel/debug")
else:
self._debugfs_cleanup = False
- self.addCopySpec("/sys/module/kvm/srcversion")
- self.addCopySpec("/sys/module/kvm_intel/srcversion")
- self.addCopySpec("/sys/module/kvm_amd/srcversion")
- self.addCopySpec("/sys/module/ksm/srcversion")
- if self.getOption('topOutput'):
- self.addCmdOutput("/usr/bin/top -b -d 1 -n 5")
- self.addCmdOutput("/usr/bin/kvm_stat --once")
+ self.add_copy_spec("/sys/module/kvm/srcversion")
+ self.add_copy_spec("/sys/module/kvm_intel/srcversion")
+ self.add_copy_spec("/sys/module/kvm_amd/srcversion")
+ self.add_copy_spec("/sys/module/ksm/srcversion")
+ if self.get_option('topOutput'):
+ self.add_cmd_output("/usr/bin/top -b -d 1 -n 5")
+ self.add_cmd_output("/usr/bin/kvm_stat --once")
def postproc(self):
if self._debugfs_cleanup and os.path.ismount("/sys/kernel/debug"):
diff --git a/sos/plugins/ldap.py b/sos/plugins/ldap.py
index 8daaf18d..dff5d625 100644
--- a/sos/plugins/ldap.py
+++ b/sos/plugins/ldap.py
@@ -29,14 +29,14 @@ class ldap(Plugin, RedHatPlugin):
results={}
tmplist=[]
for i in ldapopts:
- t=self.doRegexFindAll(r"^(%s)\s+(.*)" % i,"/etc/openldap/ldap.conf")
+ t=self.do_regex_find_all(r"^(%s)\s+(.*)" % i,"/etc/openldap/ldap.conf")
for x in t:
results[x[0]]=x[1].rstrip("\n")
return results
def setup(self):
- self.addCopySpecs(["/etc/ldap.conf", "/etc/openldap", "/etc/nslcd.conf"])
+ self.add_copy_specs(["/etc/ldap.conf", "/etc/openldap", "/etc/nslcd.conf"])
def postproc(self):
- self.doFileSub("/etc/ldap.conf", r"(\s*bindpw\s*)\S+", r"\1***")
- self.doFileSub("/etc/nslcd.conf", r"(\s*bindpw\s*)\S+", r"\1***")
+ self.do_file_sub("/etc/ldap.conf", r"(\s*bindpw\s*)\S+", r"\1***")
+ self.do_file_sub("/etc/nslcd.conf", r"(\s*bindpw\s*)\S+", r"\1***")
diff --git a/sos/plugins/libraries.py b/sos/plugins/libraries.py
index 7b41f624..32db9c82 100644
--- a/sos/plugins/libraries.py
+++ b/sos/plugins/libraries.py
@@ -18,11 +18,11 @@ class libraries(Plugin, RedHatPlugin, UbuntuPlugin):
"""information on shared libraries
"""
- optionList = [('ldconfigv', 'the name of each directory as it is scanned, and any links that are created.',
+ option_list = [('ldconfigv', 'the name of each directory as it is scanned, and any links that are created.',
"slow", False)]
def setup(self):
- self.addCopySpecs(["/etc/ld.so.conf", "/etc/ld.so.conf.d"])
- if self.getOption("ldconfigv"):
- self.addCmdOutput("/sbin/ldconfig -v -N -X")
- self.addCmdOutput("/sbin/ldconfig -p -N -X")
+ self.add_copy_specs(["/etc/ld.so.conf", "/etc/ld.so.conf.d"])
+ if self.get_option("ldconfigv"):
+ self.add_cmd_output("/sbin/ldconfig -v -N -X")
+ self.add_cmd_output("/sbin/ldconfig -p -N -X")
diff --git a/sos/plugins/libvirt.py b/sos/plugins/libvirt.py
index fa439d50..6e2930a0 100644
--- a/sos/plugins/libvirt.py
+++ b/sos/plugins/libvirt.py
@@ -19,10 +19,10 @@ class libvirt(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin):
"""libvirt-related information
"""
def setup(self):
- self.addCopySpecs(["/etc/libvirt/", "/var/log/libvirt*"])
+ self.add_copy_specs(["/etc/libvirt/", "/var/log/libvirt*"])
def postproc(self):
for xmlfile in glob.glob("/etc/libvirt/qemu/*.xml"):
- self.doFileSub(xmlfile,
+ self.do_file_sub(xmlfile,
r"(\s*passwd=\s*')([^']*)('.*$)",
r"\1******\3")
diff --git a/sos/plugins/logrotate.py b/sos/plugins/logrotate.py
index 3766b7ef..3ca35243 100644
--- a/sos/plugins/logrotate.py
+++ b/sos/plugins/logrotate.py
@@ -19,8 +19,8 @@ class logrotate(Plugin, RedHatPlugin):
"""
def setup(self):
- self.addCmdOutput("/usr/sbin/logrotate --debug /etc/logrotate.conf",
+ self.add_cmd_output("/usr/sbin/logrotate --debug /etc/logrotate.conf",
suggest_filename = "logrotate_debug")
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/logrotate*",
"/var/lib/logrotate.status"])
diff --git a/sos/plugins/lsbrelease.py b/sos/plugins/lsbrelease.py
index d9c9a4b7..055fbcb0 100644
--- a/sos/plugins/lsbrelease.py
+++ b/sos/plugins/lsbrelease.py
@@ -21,6 +21,6 @@ class lsbrelease(Plugin, RedHatPlugin):
"""
def setup(self):
- self.addCmdOutput("/usr/bin/lsb_release -a")
- self.addCmdOutput("/usr/bin/lsb_release -d", suggest_filename = "lsb_release", root_symlink = "lsb-release")
- self.addCopySpec("/etc/lsb-release*")
+ self.add_cmd_output("/usr/bin/lsb_release -a")
+ self.add_cmd_output("/usr/bin/lsb_release -d", suggest_filename = "lsb_release", root_symlink = "lsb-release")
+ self.add_copy_spec("/etc/lsb-release*")
diff --git a/sos/plugins/maas.py b/sos/plugins/maas.py
index b9478d05..9d68d1f9 100644
--- a/sos/plugins/maas.py
+++ b/sos/plugins/maas.py
@@ -20,10 +20,10 @@ class maas(Plugin, UbuntuPlugin):
""" MAAS Plugin
"""
def setup(self):
- self.addCopySpecs(["/etc/squid-deb-proxy",
+ self.add_copy_specs(["/etc/squid-deb-proxy",
"/etc/maas",
"/var/lib/maas",
"/var/log/maas*"])
- self.addCmdOutput("maas dumpdata")
- self.addCmdOutput("/usr/bin/pg_dumpall")
+ self.add_cmd_output("maas dumpdata")
+ self.add_cmd_output("/usr/bin/pg_dumpall")
diff --git a/sos/plugins/memory.py b/sos/plugins/memory.py
index ab786a2c..e5efd5c2 100644
--- a/sos/plugins/memory.py
+++ b/sos/plugins/memory.py
@@ -18,13 +18,13 @@ class memory(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""memory usage information
"""
def setup(self):
- self.addCopySpecs([
+ self.add_copy_specs([
"/proc/pci",
"/proc/meminfo",
"/proc/vmstat",
"/proc/slabinfo",
"/proc/pagetypeinfo"])
- self.addCmdOutput("/bin/dmesg | grep -e 'e820.' -e 'aperature.'")
- self.addCmdOutput("/usr/bin/free", root_symlink = "free")
- self.addCmdOutput("/usr/bin/free -m")
+ self.add_cmd_output("/bin/dmesg | grep -e 'e820.' -e 'aperature.'")
+ self.add_cmd_output("/usr/bin/free", root_symlink = "free")
+ self.add_cmd_output("/usr/bin/free -m")
diff --git a/sos/plugins/mrggrid.py b/sos/plugins/mrggrid.py
index b47fd635..31bf29bc 100644
--- a/sos/plugins/mrggrid.py
+++ b/sos/plugins/mrggrid.py
@@ -18,5 +18,5 @@ class mrggrid(Plugin, RedHatPlugin):
"""MRG GRID related information
"""
def setup(self):
- self.addCopySpec("/etc/condor/condor_config")
- self.addCopySpec("/usr/bin/condor_status")
+ self.add_copy_spec("/etc/condor/condor_config")
+ self.add_copy_spec("/usr/bin/condor_status")
diff --git a/sos/plugins/mrgmessg.py b/sos/plugins/mrgmessg.py
index 7668b6b9..0cdcb83c 100644
--- a/sos/plugins/mrgmessg.py
+++ b/sos/plugins/mrgmessg.py
@@ -18,7 +18,7 @@ class mrgmessg(Plugin, RedHatPlugin):
"""MRG Messaging related information
"""
def setup(self):
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/qpidd.conf",
"/etc/sasl2/qpidd.conf",
"/var/rhm"])
diff --git a/sos/plugins/mysql.py b/sos/plugins/mysql.py
index a2086347..1437c162 100644
--- a/sos/plugins/mysql.py
+++ b/sos/plugins/mysql.py
@@ -23,7 +23,7 @@ class mysql(Plugin, RedHatPlugin):
packages = ('mysql-server', 'mysql')
def setup(self):
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/my.cnf",
"/etc/sysconfig/network",
"/etc/ld.so.conf.d/mysql*",
diff --git a/sos/plugins/named.py b/sos/plugins/named.py
index 5740f298..812e20da 100644
--- a/sos/plugins/named.py
+++ b/sos/plugins/named.py
@@ -23,29 +23,29 @@ class named(Plugin, RedHatPlugin):
files = ('/etc/named.conf', '/etc/sysconfig/named')
packages = ('bind',)
- def getDnsDir(self, configFile):
+ def get_dns_dir(self, config_file):
""" grab directory path from named{conf,boot}
"""
- directoryList = self.doRegexFindAll("directory\s+\"(.*)\"", configFile)
- return normpath(directoryList[0])
+ directory_list = self.do_regex_find_all("directory\s+\"(.*)\"", config_file)
+ return normpath(directory_list[0])
def setup(self):
- cfgFiles = ("/etc/named.conf",
+ config_files = ("/etc/named.conf",
"/etc/named.boot")
- for cfg in cfgFiles:
+ for cfg in config_files:
if exists(cfg):
- self.addCopySpec(cfg)
- self.addCopySpec(self.getDnsDir(cfg))
- self.addForbiddenPath(join(self.getDnsDir(cfg),"chroot/dev"))
- self.addForbiddenPath(join(self.getDnsDir(cfg),"chroot/proc"))
-
- self.addCopySpec("/etc/named/")
- self.addCopySpec("/etc/sysconfig/named")
- self.addCmdOutput("klist -ket /etc/named.keytab")
- self.addForbiddenPath("/etc/named.keytab")
+ self.add_copy_spec(cfg)
+ self.add_copy_spec(self.get_dns_dir(cfg))
+ self.add_forbidden_path(join(self.get_dns_dir(cfg),"chroot/dev"))
+ self.add_forbidden_path(join(self.get_dns_dir(cfg),"chroot/proc"))
+
+ self.add_copy_spec("/etc/named/")
+ self.add_copy_spec("/etc/sysconfig/named")
+ self.add_cmd_output("klist -ket /etc/named.keytab")
+ self.add_forbidden_path("/etc/named.keytab")
return
def postproc(self):
match = r"(\s*arg \"password )[^\"]*"
subst = r"\1******"
- self.doFileSub("/etc/named.conf", match, subst)
+ self.do_file_sub("/etc/named.conf", match, subst)
diff --git a/sos/plugins/netdump.py b/sos/plugins/netdump.py
index 914e0b5f..235dd5f7 100644
--- a/sos/plugins/netdump.py
+++ b/sos/plugins/netdump.py
@@ -23,4 +23,4 @@ class netdump(Plugin, RedHatPlugin):
packages = ('netdump',)
def setup(self):
- self.addCopySpec("/etc/sysconfig/netdump")
+ self.add_copy_spec("/etc/sysconfig/netdump")
diff --git a/sos/plugins/networking.py b/sos/plugins/networking.py
index 92055007..b6b104f1 100644
--- a/sos/plugins/networking.py
+++ b/sos/plugins/networking.py
@@ -19,35 +19,35 @@ import re
class networking(Plugin, RedHatPlugin):
"""network related information
"""
- optionList = [("traceroute", "collects a traceroute to rhn.redhat.com", "slow", False)]
+ option_list = [("traceroute", "collects a traceroute to rhn.redhat.com", "slow", False)]
- def get_bridge_name(self,brctlOut):
+ def get_bridge_name(self,brctl_out):
"""Return a list for which items are bridge name according to the
- output of brctl show stored in brctlFile.
+ output of brctl show stored in brctl_file.
"""
out=[]
- for line in brctlOut[1].splitlines():
+ for line in brctl_out[1].splitlines():
if line.startswith("bridge name") \
or line.isspace() \
or line[:1].isspace():
continue
- brName, brRest = line.split(None, 1)
- out.append(brName)
+ br_name, br_rest = line.split(None, 1)
+ out.append(br_name)
return out
- def get_interface_name(self,ipaddrOut):
+ def get_interface_name(self,ip_addr_out):
"""Return a dictionary for which key are interface name according to the
- output of ifconifg-a stored in ifconfigFile.
+ output of ifconifg-a stored in ifconfig_file.
"""
out={}
- for line in ipaddrOut[1].splitlines():
+ for line in ip_addr_out[1].splitlines():
match=re.match('.*link/ether', line)
if match:
int=match.string.split(':')[1].lstrip()
out[int]=True
return out
- def collectIPTable(self,tablename):
+ def collect_iptable(self,tablename):
""" When running the iptables command, it unfortunately auto-loads
the modules before trying to get output. Some people explicitly
don't want this, so check if the modules are loaded before running
@@ -55,13 +55,13 @@ class networking(Plugin, RedHatPlugin):
relevant rules in that table """
- (status, output, time) = self.callExtProg("/sbin/lsmod | grep -q "+tablename)
+ (status, output, time) = self.call_ext_prog("/sbin/lsmod | grep -q "+tablename)
if status == 0:
cmd = "/sbin/iptables -t "+tablename+" -nvL"
- self.addCmdOutput(cmd)
+ self.add_cmd_output(cmd)
def setup(self):
- self.addCopySpecs([
+ self.add_copy_specs([
"/proc/net/",
"/etc/nsswitch.conf",
"/etc/yp.conf",
@@ -70,40 +70,40 @@ class networking(Plugin, RedHatPlugin):
"/etc/xinetd.d",
"/etc/host*",
"/etc/resolv.conf"])
- ipaddrFile=self.getCmdOutputNow("/sbin/ip -o addr", root_symlink = "ip_addr")
- ipaddrOut=self.callExtProg("/sbin/ip -o addr")
- self.addCmdOutput("/sbin/route -n", root_symlink = "route")
- self.collectIPTable("filter")
- self.collectIPTable("nat")
- self.collectIPTable("mangle")
- self.addCmdOutput("/bin/netstat -s")
- self.addCmdOutput("/bin/netstat -agn")
- self.addCmdOutput("/bin/netstat -neopa", root_symlink = "netstat")
- self.addCmdOutput("/sbin/ip route show table all")
- self.addCmdOutput("/sbin/ip -6 route show table all")
- self.addCmdOutput("/sbin/ip link")
- self.addCmdOutput("/sbin/ip address")
- self.addCmdOutput("/sbin/ifenslave -a")
- self.addCmdOutput("/sbin/ip mroute show")
- self.addCmdOutput("/sbin/ip maddr show")
- self.addCmdOutput("/sbin/ip neigh show")
- if ipaddrOut:
- for eth in self.get_interface_name(ipaddrOut):
- self.addCmdOutput("/sbin/ethtool "+eth)
- self.addCmdOutput("/sbin/ethtool -i "+eth)
- self.addCmdOutput("/sbin/ethtool -k "+eth)
- self.addCmdOutput("/sbin/ethtool -S "+eth)
- self.addCmdOutput("/sbin/ethtool -a "+eth)
- self.addCmdOutput("/sbin/ethtool -c "+eth)
- self.addCmdOutput("/sbin/ethtool -g "+eth)
- if self.getOption("traceroute"):
- self.addCmdOutput("/bin/traceroute -n rhn.redhat.com")
+ ip_addr_file=self.get_cmd_output_now("/sbin/ip -o addr", root_symlink = "ip_addr")
+ ip_addr_out=self.call_ext_prog("/sbin/ip -o addr")
+ self.add_cmd_output("/sbin/route -n", root_symlink = "route")
+ self.collect_iptable("filter")
+ self.collect_iptable("nat")
+ self.collect_iptable("mangle")
+ self.add_cmd_output("/bin/netstat -s")
+ self.add_cmd_output("/bin/netstat -agn")
+ self.add_cmd_output("/bin/netstat -neopa", root_symlink = "netstat")
+ self.add_cmd_output("/sbin/ip route show table all")
+ self.add_cmd_output("/sbin/ip -6 route show table all")
+ self.add_cmd_output("/sbin/ip link")
+ self.add_cmd_output("/sbin/ip address")
+ self.add_cmd_output("/sbin/ifenslave -a")
+ self.add_cmd_output("/sbin/ip mroute show")
+ self.add_cmd_output("/sbin/ip maddr show")
+ self.add_cmd_output("/sbin/ip neigh show")
+ if ip_addr_out:
+ for eth in self.get_interface_name(ip_addr_out):
+ self.add_cmd_output("/sbin/ethtool "+eth)
+ self.add_cmd_output("/sbin/ethtool -i "+eth)
+ self.add_cmd_output("/sbin/ethtool -k "+eth)
+ self.add_cmd_output("/sbin/ethtool -S "+eth)
+ self.add_cmd_output("/sbin/ethtool -a "+eth)
+ self.add_cmd_output("/sbin/ethtool -c "+eth)
+ self.add_cmd_output("/sbin/ethtool -g "+eth)
+ if self.get_option("traceroute"):
+ self.add_cmd_output("/bin/traceroute -n rhn.redhat.com")
if os.path.exists("/usr/sbin/brctl"):
- brctlFile=self.addCmdOutput("/usr/sbin/brctl show")
- brctlOut=self.callExtProg("/usr/sbin/brctl show")
- if brctlOut:
- for brName in self.get_bridge_name(brctlOut):
- self.addCmdOutput("/usr/sbin/brctl showstp "+brName)
+ brctl_file=self.add_cmd_output("/usr/sbin/brctl show")
+ brctl_out=self.call_ext_prog("/usr/sbin/brctl show")
+ if brctl_out:
+ for br_name in self.get_bridge_name(brctl_out):
+ self.add_cmd_output("/usr/sbin/brctl showstp "+br_name)
return
diff --git a/sos/plugins/nfsserver.py b/sos/plugins/nfsserver.py
index b1acbcf7..1229dcf1 100644
--- a/sos/plugins/nfsserver.py
+++ b/sos/plugins/nfsserver.py
@@ -21,8 +21,8 @@ from stat import ST_SIZE
class nfsserver(Plugin, RedHatPlugin):
"""NFS server-related information
"""
- def checkenabled(self):
- if self.policy().runlevelDefault() in self.policy().runlevelByService("nfs"):
+ def check_enabled(self):
+ if self.policy().default_runlevel() in self.policy().runlevel_by_service("nfs"):
return True
try:
@@ -34,10 +34,10 @@ class nfsserver(Plugin, RedHatPlugin):
return False
def setup(self):
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/exports",
"/var/lib/nfs/etab",
"/var/lib/nfs/xtab",
"/var/lib/nfs/rmtab"])
- self.addCmdOutput("/usr/sbin/rpcinfo -p localhost")
- self.addCmdOutput("/usr/sbin/nfsstat -a")
+ self.add_cmd_output("/usr/sbin/rpcinfo -p localhost")
+ self.add_cmd_output("/usr/sbin/nfsstat -a")
diff --git a/sos/plugins/nis.py b/sos/plugins/nis.py
index 905fd239..4f4d6258 100644
--- a/sos/plugins/nis.py
+++ b/sos/plugins/nis.py
@@ -25,5 +25,5 @@ class nis(Plugin, RedHatPlugin):
files = ('/var/yp',)
def setup(self):
- self.addCopySpec("/etc/yp*.conf")
- self.addCopySpec("/var/yp/*")
+ self.add_copy_spec("/etc/yp*.conf")
+ self.add_copy_spec("/var/yp/*")
diff --git a/sos/plugins/nscd.py b/sos/plugins/nscd.py
index 5c98e864..8139fac9 100644
--- a/sos/plugins/nscd.py
+++ b/sos/plugins/nscd.py
@@ -20,18 +20,18 @@ class nscd(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""NSCD related information
"""
- optionList = [("nscdlogsize", "max size (MiB) to collect per nscd log file",
+ option_list = [("nscdlogsize", "max size (MiB) to collect per nscd log file",
"", 50)]
files = ('/etc/nscd.conf',)
packages = ('nscd',)
def setup(self):
- self.addCopySpec("/etc/nscd.conf")
+ self.add_copy_spec("/etc/nscd.conf")
- opt = self.fileGrep(r"^\s*logfile", "/etc/nscd.conf")
+ opt = self.file_grep(r"^\s*logfile", "/etc/nscd.conf")
if (len(opt) > 0):
for o in opt:
f = o.split()
- self.addCopySpecLimit(f[1],
- sizelimit = self.isOptionEnabled("nscdlogsize"))
+ self.add_copy_spec_limit(f[1],
+ sizelimit = self.option_enabled("nscdlogsize"))
diff --git a/sos/plugins/ntp.py b/sos/plugins/ntp.py
index b47ff4a8..c87a61b1 100644
--- a/sos/plugins/ntp.py
+++ b/sos/plugins/ntp.py
@@ -21,5 +21,5 @@ class ntp(Plugin, RedHatPlugin):
packages = ('ntp',)
def setup(self):
- self.addCmdOutput("/usr/bin/ntpstat")
- self.addCmdOutput("/usr/sbin/ntptime")
+ self.add_cmd_output("/usr/bin/ntpstat")
+ self.add_cmd_output("/usr/sbin/ntptime")
diff --git a/sos/plugins/oddjob.py b/sos/plugins/oddjob.py
index e64d6816..6d38e74a 100644
--- a/sos/plugins/oddjob.py
+++ b/sos/plugins/oddjob.py
@@ -24,6 +24,6 @@ class oddjob(Plugin, RedHatPlugin):
packages = ('oddjob',)
def setup(self):
- self.addCopySpec("/etc/oddjobd.conf")
- self.addCopySpec("/etc/oddjobd.conf.d")
- self.addCopySpec("/etc/dbus-1/system.d/oddjob.conf")
+ self.add_copy_spec("/etc/oddjobd.conf")
+ self.add_copy_spec("/etc/oddjobd.conf.d")
+ self.add_copy_spec("/etc/dbus-1/system.d/oddjob.conf")
diff --git a/sos/plugins/openssl.py b/sos/plugins/openssl.py
index 9bf3e574..81815adc 100644
--- a/sos/plugins/openssl.py
+++ b/sos/plugins/openssl.py
@@ -31,7 +31,7 @@ class RedHatOpenssl(openssl, RedHatPlugin):
def setup(self):
super(RedHatOpenssl, self).setup()
- self.addCopySpec("/etc/pki/tls/openssl.cnf")
+ self.add_copy_spec("/etc/pki/tls/openssl.cnf")
class DebianOpenssl(openssl, DebianPlugin, UbuntuPlugin):
"""openssl related information for Debian distributions
@@ -41,4 +41,4 @@ class DebianOpenssl(openssl, DebianPlugin, UbuntuPlugin):
def setup(self):
super(DebianOpenssl, self).setup()
- self.addCopySpec("/etc/ssl/openssl.cnf")
+ self.add_copy_spec("/etc/ssl/openssl.cnf")
diff --git a/sos/plugins/openstack.py b/sos/plugins/openstack.py
index a33185ab..b6ea1756 100644
--- a/sos/plugins/openstack.py
+++ b/sos/plugins/openstack.py
@@ -25,7 +25,7 @@ class openstack(Plugin):
"""
plugin_name = "openstack"
- optionList = [("log", "gathers all openstack logs", "slow", False)]
+ option_list = [("log", "gathers all openstack logs", "slow", False)]
class DebianOpenStack(openstack, DebianPlugin, UbuntuPlugin):
@@ -89,51 +89,51 @@ class DebianOpenStack(openstack, DebianPlugin, UbuntuPlugin):
def setup(self):
# Nova
if os.path.exists("/usr/bin/nova-manage"):
- self.addCmdOutput(
+ self.add_cmd_output(
"/usr/bin/nova-manage config list 2>/dev/null | sort",
suggest_filename="nova_config_list")
- self.addCmdOutput(
+ self.add_cmd_output(
"/usr/bin/nova-manage service list 2>/dev/null",
suggest_filename="nova_service_list")
- self.addCmdOutput(
+ self.add_cmd_output(
"/usr/bin/nova-manage db version 2>/dev/null",
suggest_filename="nova_db_version")
- self.addCmdOutput(
+ self.add_cmd_output(
"/usr/bin/nova-manage fixed list 2>/dev/null",
suggest_filename="nova_fixed_ip_list")
- self.addCmdOutput(
+ self.add_cmd_output(
"/usr/bin/nova-manage floating list 2>/dev/null",
suggest_filename="nova_floating_ip_list")
- self.addCmdOutput(
+ self.add_cmd_output(
"/usr/bin/nova-manage flavor list 2>/dev/null",
suggest_filename="nova_flavor_list")
- self.addCmdOutput(
+ self.add_cmd_output(
"/usr/bin/nova-manage network list 2>/dev/null",
suggest_filename="nova_network_list")
- self.addCmdOutput(
+ self.add_cmd_output(
"/usr/bin/nova-manage vm list 2>/dev/null",
suggest_filename="nova_vm_list")
- self.addCopySpecs(["/etc/nova/",
+ self.add_copy_specs(["/etc/nova/",
"/var/log/nova/",
"/etc/default/nova-volume",
"/etc/sudoers.d/nova_sudoers",
"/etc/logrotate.d/nova-*"])
# Glance
if os.path.exists("/usr/bin/glance-manage"):
- self.addCmdOutput(
+ self.add_cmd_output(
"/usr/bin/glance-manage db_version",
suggest_filename="glance_db_version")
- self.addCopySpecs(["/etc/glance/",
+ self.add_copy_specs(["/etc/glance/",
"/var/log/glance/",
"/etc/logrotate.d/glance-*"])
# Keystone
- self.addCopySpecs(["/etc/keystone/",
+ self.add_copy_specs(["/etc/keystone/",
"/var/log/keystone/",
"/etc/logrotate.d/keystone"])
# Swift
- self.addCopySpecs(["/etc/swift/"])
+ self.add_copy_specs(["/etc/swift/"])
# Quantum
- self.addCopySpecs(["/etc/quantum/",
+ self.add_copy_specs(["/etc/quantum/",
"/var/log/quantum/"])
@@ -163,10 +163,10 @@ class RedHatOpenStack(openstack, RedHatPlugin):
# If RHEL or Fedora then invoke script for openstack-status
if (os.path.isfile('/etc/redhat-release')
or os.path.isfile('/etc/fedora-release')):
- self.addCmdOutput("/usr/bin/openstack-status")
+ self.add_cmd_output("/usr/bin/openstack-status")
# Nova
- self.addCopySpecs(["/etc/nova/",
+ self.add_copy_specs(["/etc/nova/",
"/var/log/nova/",
"/var/lib/nova/",
"/etc/polkit-1/localauthority/50-local.d/50-nova.pkla",
@@ -174,19 +174,19 @@ class RedHatOpenStack(openstack, RedHatPlugin):
"/etc/logrotate.d/openstack-nova"])
# Glance
- self.addCopySpecs(["/etc/glance/",
+ self.add_copy_specs(["/etc/glance/",
"/var/log/glance/",
"/etc/logrotate.d/openstack-glance"])
# Keystone
- self.addCopySpecs(["/etc/keystone/",
+ self.add_copy_specs(["/etc/keystone/",
"/var/log/keystone/"])
# Quantum
- self.addCopySpecs(["/etc/quantum/",
+ self.add_copy_specs(["/etc/quantum/",
"/var/log/quantum/"])
def postproc(self):
- self.doFileSub('/etc/keystone/keystone.conf',
+ self.do_file_sub('/etc/keystone/keystone.conf',
r"(admin_password\s*=\s*)(.*)",
r"\1******")
diff --git a/sos/plugins/openswan.py b/sos/plugins/openswan.py
index fa1a99d2..6d17136d 100644
--- a/sos/plugins/openswan.py
+++ b/sos/plugins/openswan.py
@@ -25,8 +25,8 @@ class openswan(Plugin, RedHatPlugin):
packages = ('openswan',)
def setup(self):
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/ipsec.conf",
"/etc/ipsec.d"])
- self.addCmdOutput("/usr/sbin/ipsec verify")
- self.addCmdOutput("/usr/sbin/ipsec barf")
+ self.add_cmd_output("/usr/sbin/ipsec verify")
+ self.add_cmd_output("/usr/sbin/ipsec barf")
diff --git a/sos/plugins/pam.py b/sos/plugins/pam.py
index e040f382..5ebff028 100644
--- a/sos/plugins/pam.py
+++ b/sos/plugins/pam.py
@@ -18,6 +18,6 @@ class pam(Plugin, RedHatPlugin):
"""PAM related information
"""
def setup(self):
- self.addCopySpec("/etc/pam.d")
- self.addCopySpec("/etc/security")
- self.addCmdOutput("/bin/ls -lanF /lib*/security")
+ self.add_copy_spec("/etc/pam.d")
+ self.add_copy_spec("/etc/security")
+ self.add_cmd_output("/bin/ls -lanF /lib*/security")
diff --git a/sos/plugins/postfix.py b/sos/plugins/postfix.py
index b7748589..0d7a671c 100644
--- a/sos/plugins/postfix.py
+++ b/sos/plugins/postfix.py
@@ -23,8 +23,8 @@ class postfix(Plugin, RedHatPlugin):
packages = ('postfix',)
def setup(self):
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/mail",
"/etc/postfix/main.cf",
"/etc/postfix/master.cf"])
- self.addCmdOutput("/usr/sbin/postconf")
+ self.add_cmd_output("/usr/sbin/postconf")
diff --git a/sos/plugins/postgresql.py b/sos/plugins/postgresql.py
index 6a999f45..1ae269fb 100644
--- a/sos/plugins/postgresql.py
+++ b/sos/plugins/postgresql.py
@@ -14,7 +14,7 @@ class postgresql(Plugin, RedHatPlugin):
tmp_dir = None
- optionList = [
+ option_list = [
("pghome", 'PostgreSQL server home directory.', '', '/var/lib/pgsql'),
("username", 'username for pg_dump', '', 'postgres'),
("password", 'password for pg_dump', '', ''),
@@ -24,35 +24,35 @@ class postgresql(Plugin, RedHatPlugin):
def pg_dump(self):
dest_file = os.path.join(self.tmp_dir, "sos_pgdump.tar")
old_env_pgpassword = os.environ.get("PGPASSWORD")
- os.environ["PGPASSWORD"] = self.getOption("password")
- (status, output, rtime) = self.callExtProg("pg_dump %s -U %s -w -f %s -F t" %
- (self.getOption("dbname"),
- self.getOption("username"),
+ os.environ["PGPASSWORD"] = self.get_option("password")
+ (status, output, rtime) = self.call_ext_prog("pg_dump %s -U %s -w -f %s -F t" %
+ (self.get_option("dbname"),
+ self.get_option("username"),
dest_file))
if old_env_pgpassword is not None:
os.environ["PGPASSWORD"] = old_env_pgpassword
if (status == 0):
- self.addCopySpec(dest_file)
+ self.add_copy_spec(dest_file)
else:
- self.addAlert("ERROR: Unable to execute pg_dump. Error(%s)" % (output))
+ self.add_alert("ERROR: Unable to execute pg_dump. Error(%s)" % (output))
def setup(self):
- if self.getOption("dbname"):
- if self.getOption("password"):
+ if self.get_option("dbname"):
+ if self.get_option("password"):
self.tmp_dir = tempfile.mkdtemp()
self.pg_dump()
else:
- self.addAlert("WARN: password must be supplied to dump a database.")
+ self.add_alert("WARN: password must be supplied to dump a database.")
# Copy PostgreSQL log files.
- for file in find("*.log", self.getOption("pghome")):
- self.addCopySpec(file)
+ for file in find("*.log", self.get_option("pghome")):
+ self.add_copy_spec(file)
# Copy PostgreSQL config files.
- for file in find("*.conf", self.getOption("pghome")):
- self.addCopySpec(file)
+ for file in find("*.conf", self.get_option("pghome")):
+ self.add_copy_spec(file)
- self.addCopySpec(os.path.join(self.getOption("pghome"), "data" , "PG_VERSION"))
- self.addCopySpec(os.path.join(self.getOption("pghome"), "data" , "postmaster.opts"))
+ self.add_copy_spec(os.path.join(self.get_option("pghome"), "data" , "PG_VERSION"))
+ self.add_copy_spec(os.path.join(self.get_option("pghome"), "data" , "postmaster.opts"))
def postproc(self):
diff --git a/sos/plugins/ppp.py b/sos/plugins/ppp.py
index 8c09b8c7..8f04a3f4 100644
--- a/sos/plugins/ppp.py
+++ b/sos/plugins/ppp.py
@@ -25,8 +25,8 @@ class ppp(Plugin, RedHatPlugin):
packages = ('ppp',)
def setup(self):
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/wvdial.conf",
"/etc/ppp",
"/var/log/ppp"])
- self.addCmdOutput("/usr/sbin/adsl-status")
+ self.add_cmd_output("/usr/sbin/adsl-status")
diff --git a/sos/plugins/printing.py b/sos/plugins/printing.py
index 668139f0..fc85af22 100644
--- a/sos/plugins/printing.py
+++ b/sos/plugins/printing.py
@@ -17,15 +17,15 @@ from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class printing(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""printing related information (cups)
"""
- optionList = [("cups", "max size (MiB) to collect per cups log file",
+ option_list = [("cups", "max size (MiB) to collect per cups log file",
"", 50)]
def setup(self):
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/cups/*.conf",
"/etc/cups/lpoptions",
"/etc/cups/ppd/*.ppd"])
- self.addCopySpecLimit("/var/log/cups", sizelimit=self.isOptionEnabled("cupslogsize"))
- self.addCmdOutput("/usr/bin/lpstat -t")
- self.addCmdOutput("/usr/bin/lpstat -s")
- self.addCmdOutput("/usr/bin/lpstat -d")
+ self.add_copy_spec_limit("/var/log/cups", sizelimit=self.option_enabled("cupslogsize"))
+ self.add_cmd_output("/usr/bin/lpstat -t")
+ self.add_cmd_output("/usr/bin/lpstat -s")
+ self.add_cmd_output("/usr/bin/lpstat -d")
diff --git a/sos/plugins/process.py b/sos/plugins/process.py
index 42ae5bf3..f90dab83 100644
--- a/sos/plugins/process.py
+++ b/sos/plugins/process.py
@@ -20,11 +20,11 @@ class process(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""process information
"""
def setup(self):
- self.addCmdOutput("/bin/ps auxwww", root_symlink = "ps")
- self.addCmdOutput("/bin/ps auxwwwm")
- self.addCmdOutput("/bin/ps alxwww")
- self.addCmdOutput("/usr/bin/pstree", root_symlink = "pstree")
- self.addCmdOutput("/usr/sbin/lsof -b +M -n -l", root_symlink = "lsof")
+ self.add_cmd_output("/bin/ps auxwww", root_symlink = "ps")
+ self.add_cmd_output("/bin/ps auxwwwm")
+ self.add_cmd_output("/bin/ps alxwww")
+ self.add_cmd_output("/usr/bin/pstree", root_symlink = "pstree")
+ self.add_cmd_output("/usr/sbin/lsof -b +M -n -l", root_symlink = "lsof")
def find_mountpoint(s):
if (os.path.ismount(s) or len(s)==0): return s
diff --git a/sos/plugins/psacct.py b/sos/plugins/psacct.py
index 8a640fb0..528f141c 100644
--- a/sos/plugins/psacct.py
+++ b/sos/plugins/psacct.py
@@ -18,12 +18,12 @@ class psacct(Plugin, RedHatPlugin):
"""Process accounting related information
"""
- optionList = [("all", "collect all process accounting files",
+ option_list = [("all", "collect all process accounting files",
"slow", False)]
packages = [ "psacct" ]
def setup(self):
- self.addCopySpec("/var/account/pacct")
- if self.getOption("all"):
- self.addCopySpec("/var/account/pacct*.gz")
+ self.add_copy_spec("/var/account/pacct")
+ if self.get_option("all"):
+ self.add_copy_spec("/var/account/pacct*.gz")
diff --git a/sos/plugins/pxe.py b/sos/plugins/pxe.py
index e0307351..4cdd2f76 100644
--- a/sos/plugins/pxe.py
+++ b/sos/plugins/pxe.py
@@ -19,12 +19,12 @@ class pxe(Plugin, RedHatPlugin):
"""PXE related information
"""
- optionList = [("tftpboot", 'gathers content in /tftpboot', 'slow', False)]
+ option_list = [("tftpboot", 'gathers content in /tftpboot', 'slow', False)]
files = ('/usr/sbin/pxeos',)
packages = ('system-config-netboot-cmd',)
def setup(self):
- self.addCmdOutput("/usr/sbin/pxeos -l")
- self.addCopySpec("/etc/dhcpd.conf")
- if self.getOption("tftpboot"):
- self.addCopySpec("/tftpboot")
+ self.add_cmd_output("/usr/sbin/pxeos -l")
+ self.add_copy_spec("/etc/dhcpd.conf")
+ if self.get_option("tftpboot"):
+ self.add_copy_spec("/tftpboot")
diff --git a/sos/plugins/qpidd.py b/sos/plugins/qpidd.py
index 922cad80..a59251bf 100644
--- a/sos/plugins/qpidd.py
+++ b/sos/plugins/qpidd.py
@@ -22,17 +22,17 @@ class qpidd(Plugin, RedHatPlugin):
def setup(self):
""" performs data collection for mrg """
- self.addCmdOutput("/usr/bin/qpid-stat -e")
- self.addCmdOutput("/usr/bin/qpid-stat -b")
- self.addCmdOutput("/usr/bin/qpid-config")
- self.addCmdOutput("/usr/bin/qpid-config -b exchanges")
- self.addCmdOutput("/usr/bin/qpid-config -b queues")
- self.addCmdOutput("/usr/bin/qpid-stat -c")
- self.addCmdOutput("/usr/bin/qpid-route link list")
- self.addCmdOutput("/usr/bin/qpid-route route list")
- self.addCmdOutput("/bin/ls -lanR /var/lib/qpidd")
+ self.add_cmd_output("/usr/bin/qpid-stat -e")
+ self.add_cmd_output("/usr/bin/qpid-stat -b")
+ self.add_cmd_output("/usr/bin/qpid-config")
+ self.add_cmd_output("/usr/bin/qpid-config -b exchanges")
+ self.add_cmd_output("/usr/bin/qpid-config -b queues")
+ self.add_cmd_output("/usr/bin/qpid-stat -c")
+ self.add_cmd_output("/usr/bin/qpid-route link list")
+ self.add_cmd_output("/usr/bin/qpid-route route list")
+ self.add_cmd_output("/bin/ls -lanR /var/lib/qpidd")
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/qpidd.conf",
"/var/lib/qpid/syslog",
"/etc/ais/openais.conf",
diff --git a/sos/plugins/quagga.py b/sos/plugins/quagga.py
index d9fb6394..28ba983f 100644
--- a/sos/plugins/quagga.py
+++ b/sos/plugins/quagga.py
@@ -25,4 +25,4 @@ class quagga(Plugin, RedHatPlugin):
packages = ('quagga',)
def setup(self):
- self.addCopySpec("/etc/quagga/")
+ self.add_copy_spec("/etc/quagga/")
diff --git a/sos/plugins/radius.py b/sos/plugins/radius.py
index 472c06b0..972b179c 100644
--- a/sos/plugins/radius.py
+++ b/sos/plugins/radius.py
@@ -32,10 +32,10 @@ class RedHatRadius(radius, RedHatPlugin):
def setup(self):
super(RedHatRadius, self).setup()
- self.addCopySpecs(["/etc/raddb", "/etc/pam.d/radiusd", "/var/log/radius"])
+ self.add_copy_specs(["/etc/raddb", "/etc/pam.d/radiusd", "/var/log/radius"])
def postproc(self):
- self.doFileSub("/etc/raddb/sql.conf", r"(\s*password\s*=\s*)\S+", r"\1***")
+ self.do_file_sub("/etc/raddb/sql.conf", r"(\s*password\s*=\s*)\S+", r"\1***")
class DebianRadius(radius, DebianPlugin, UbuntuPlugin):
"""radius related information on Debian distributions
@@ -45,7 +45,7 @@ class DebianRadius(radius, DebianPlugin, UbuntuPlugin):
def setup(self):
super(DebianRadius, self).setup()
- self.addCopySpecs(["/etc/freeradius",
+ self.add_copy_specs(["/etc/freeradius",
"/etc/pam.d/radiusd",
"/etc/default/freeradius",
"/var/log/freeradius"])
diff --git a/sos/plugins/rhevm.py b/sos/plugins/rhevm.py
index e1575465..a9cd5f2d 100644
--- a/sos/plugins/rhevm.py
+++ b/sos/plugins/rhevm.py
@@ -4,20 +4,20 @@ from sos.plugins import Plugin, RedHatPlugin
class rhevm(Plugin, RedHatPlugin):
"""Nogah related information"""
- optionList = [("vdsmlogs", 'Directory containing all of the SOS logs from the RHEV hypervisor(s)', '', False)]
+ option_list = [("vdsmlogs", 'Directory containing all of the SOS logs from the RHEV hypervisor(s)', '', False)]
def setup(self):
# Copy rhevm config files.
- self.addCopySpec("/etc/rhevm")
- self.addCopySpec("/var/log/rhevm")
- if self.getOption("vdsmlogs"):
- self.addCopySpec(self.getOption("vdsmlogs"))
+ self.add_copy_spec("/etc/rhevm")
+ self.add_copy_spec("/var/log/rhevm")
+ if self.get_option("vdsmlogs"):
+ self.add_copy_spec(self.get_option("vdsmlogs"))
def postproc(self):
"""
Obfuscate passwords.
"""
- self.doFileSub("/etc/rhevm/rhevm-config/rhevm-config.properties",
+ self.do_file_sub("/etc/rhevm/rhevm-config/rhevm-config.properties",
r"Password.type=(.*)",
r'Password.type=********')
diff --git a/sos/plugins/rhn.py b/sos/plugins/rhn.py
index 72228bec..0686c8bd 100644
--- a/sos/plugins/rhn.py
+++ b/sos/plugins/rhn.py
@@ -21,42 +21,42 @@ class rhn(Plugin, RedHatPlugin):
satellite = False
proxy = False
- optionList = [("log", 'gathers all apache logs', 'slow', False)]
+ option_list = [("log", 'gathers all apache logs', 'slow', False)]
- def defaultenabled(self):
+ def default_enabled(self):
return False
def rhn_package_check(self):
- self.satellite = self.isInstalled("rhns-satellite-tools") \
- or self.isInstalled("spacewalk-java") \
- or self.isInstalled("rhn-base")
- self.proxy = self.isInstalled("rhns-proxy-tools") \
- or self.isInstalled("spacewalk-proxy-management") \
- or self.isInstalled("rhn-proxy-management")
+ self.satellite = self.is_installed("rhns-satellite-tools") \
+ or self.is_installed("spacewalk-java") \
+ or self.is_installed("rhn-base")
+ self.proxy = self.is_installed("rhns-proxy-tools") \
+ or self.is_installed("spacewalk-proxy-management") \
+ or self.is_installed("rhn-proxy-management")
return self.satellite or self.proxy
- def checkenabled(self):
+ def check_enabled(self):
# enable if any related package is installed
return self.rhn_package_check()
def setup(self):
self.rhn_package_check()
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/httpd/conf*",
"/etc/rhn",
"/var/log/rhn*"])
- if self.getOption("log"):
- self.addCopySpec("/var/log/httpd")
+ if self.get_option("log"):
+ self.add_copy_spec("/var/log/httpd")
# all these used to go in $DIR/mon-logs/
- self.addCopySpecs([
+ self.add_copy_specs([
"/opt/notification/var/*.log*",
"/var/tmp/ack_handler.log*",
"/var/tmp/enqueue.log*"])
# monitoring scout logs
- self.addCopySpecs([
+ self.add_copy_specs([
"/home/nocpulse/var/*.log*",
"/home/nocpulse/var/commands/*.log*",
"/var/tmp/ack_handler.log*",
@@ -65,19 +65,19 @@ class rhn(Plugin, RedHatPlugin):
"/var/log/notification/*.log*",
"/var/log/nocpulse/TSDBLocalQueue/TSDBLocalQueue.log"])
- self.addCopySpec("/root/ssl-build")
- self.addCmdOutput("/usr/bin/rhn-schema-version",
+ self.add_copy_spec("/root/ssl-build")
+ self.add_cmd_output("/usr/bin/rhn-schema-version",
root_symlink = "database-schema-version")
- self.addCmdOutput("/usr/bin/rhn-charsets",
+ self.add_cmd_output("/usr/bin/rhn-charsets",
root_symlink = "database-character-sets")
if self.satellite:
- self.addCopySpecs(["/etc/tnsnames.ora", "/etc/jabberd",
+ self.add_copy_specs(["/etc/tnsnames.ora", "/etc/jabberd",
"/etc/tomcat6/", "/var/log/tomcat6/"])
if os.path.exists("/usr/bin/spacewalk-debug"):
- self.addCmdOutput("/usr/bin/spacewalk-debug --dir %s"
- % os.path.join(self.cInfo['dstroot'],
+ self.add_cmd_output("/usr/bin/spacewalk-debug --dir %s"
+ % os.path.join(self.commons['dstroot'],
"sos_commands/rhn"))
if self.proxy:
- self.addCopySpecs(["/etc/squid", "/var/log/squid"])
+ self.add_copy_specs(["/etc/squid", "/var/log/squid"])
diff --git a/sos/plugins/rhui.py b/sos/plugins/rhui.py
index 39ef0416..78874098 100644
--- a/sos/plugins/rhui.py
+++ b/sos/plugins/rhui.py
@@ -25,19 +25,19 @@ class rhui(Plugin, RedHatPlugin):
files = [ rhui_debug_path ]
def setup(self):
- if self.isInstalled("pulp-cds"):
+ if self.is_installed("pulp-cds"):
cds = "--cds"
else:
cds = ""
- rhui_debug_dst_path = os.path.join(self.cInfo['dstroot'],
- self.cInfo['cmddir'], self.name())
+ rhui_debug_dst_path = os.path.join(self.commons['dstroot'],
+ self.commons['cmddir'], self.name())
try:
os.mkdir(rhui_debug_dst_path)
except:
return
- self.addCmdOutput("python %s %s --dir %s"
+ self.add_cmd_output("python %s %s --dir %s"
% (self.rhui_debug_path, cds, rhui_debug_dst_path),
suggest_filename="rhui-debug")
return
diff --git a/sos/plugins/rpm.py b/sos/plugins/rpm.py
index 669231ff..3acf7ec1 100644
--- a/sos/plugins/rpm.py
+++ b/sos/plugins/rpm.py
@@ -17,19 +17,19 @@ from sos.plugins import Plugin, RedHatPlugin
class rpm(Plugin, RedHatPlugin):
"""RPM information
"""
- optionList = [("rpmq", "queries for package information via rpm -q", "fast", True),
+ option_list = [("rpmq", "queries for package information via rpm -q", "fast", True),
("rpmva", "runs a verify on all packages", "slow", False)]
def setup(self):
- self.addCopySpec("/var/log/rpmpkgs")
+ self.add_copy_spec("/var/log/rpmpkgs")
- if self.getOption("rpmq"):
- self.addCmdOutput("/bin/rpm -qa --qf="
+ if self.get_option("rpmq"):
+ self.add_cmd_output("/bin/rpm -qa --qf="
"\"%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}~~"
"%{INSTALLTIME:date}\t%{INSTALLTIME}\t%{VENDOR}\n\""
" --nosignature --nodigest | /bin/awk -F '~~' "
"'{printf \"%-59s %s\\n\",$1,$2}'|sort",
root_symlink = "installed-rpms")
- if self.getOption("rpmva"):
- self.addCmdOutput("/bin/rpm -Va", root_symlink = "rpm-Va", timeout = 3600)
+ if self.get_option("rpmva"):
+ self.add_cmd_output("/bin/rpm -Va", root_symlink = "rpm-Va", timeout = 3600)
diff --git a/sos/plugins/s390.py b/sos/plugins/s390.py
index 21fbd54e..5b5e8274 100644
--- a/sos/plugins/s390.py
+++ b/sos/plugins/s390.py
@@ -23,13 +23,13 @@ class s390(Plugin, RedHatPlugin):
### Check for s390 arch goes here
- def checkenabled(self):
- return (self.policy().getArch() == "s390")
+ def check_enabled(self):
+ return (self.policy().get_arch() == "s390")
### Gather s390 specific information
def setup(self):
- self.addCopySpecs([
+ self.add_copy_specs([
"/proc/cio_ignore"
"/proc/crypto",
"/proc/dasd/devices",
@@ -51,20 +51,20 @@ class s390(Plugin, RedHatPlugin):
"/etc/src_vipa.conf",
"/etc/ccwgroup.conf",
"/etc/chandev.conf"])
- self.addCmdOutput("/sbin/lscss")
- self.addCmdOutput("/sbin/lsdasd")
- self.addCmdOutput("/sbin/lstape")
- self.addCmdOutput("find /sys -type f")
- self.addCmdOutput("find /proc/s390dbf -type f")
- self.addCmdOutput("/sbin/qethconf list_all")
- ret, dasdDev, rtime = self.callExtProg("/bin/ls /dev/dasd?")
- for x in dasdDev.split('\n'):
- self.addCmdOutput("/sbin/dasdview -x -i -j -l -f %s" % (x,))
- self.addCmdOutput("/sbin/fdasd -p %s" % (x,))
+ self.add_cmd_output("/sbin/lscss")
+ self.add_cmd_output("/sbin/lsdasd")
+ self.add_cmd_output("/sbin/lstape")
+ self.add_cmd_output("find /sys -type f")
+ self.add_cmd_output("find /proc/s390dbf -type f")
+ self.add_cmd_output("/sbin/qethconf list_all")
+ ret, dasd_dev, rtime = self.call_ext_prog("/bin/ls /dev/dasd?")
+ for x in dasd_dev.split('\n'):
+ self.add_cmd_output("/sbin/dasdview -x -i -j -l -f %s" % (x,))
+ self.add_cmd_output("/sbin/fdasd -p %s" % (x,))
try:
- rhelver = self.policy().rhelVersion()
+ rhelver = self.policy().rhel_version()
if rhelver == 5:
- self.addCmdOutput("/sbin/lsqeth")
- self.addCmdOutput("/sbin/lszfcp")
+ self.add_cmd_output("/sbin/lsqeth")
+ self.add_cmd_output("/sbin/lszfcp")
except:
rhelver = None
diff --git a/sos/plugins/samba.py b/sos/plugins/samba.py
index e998bdae..10153343 100644
--- a/sos/plugins/samba.py
+++ b/sos/plugins/samba.py
@@ -18,11 +18,11 @@ class samba(Plugin, RedHatPlugin):
"""Samba related information
"""
def setup(self):
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/samba",
"/var/log/samba/*",
"/etc/krb5.conf",
"/etc/krb5.keytab"])
- self.addCmdOutput("/usr/bin/wbinfo -g")
- self.addCmdOutput("/usr/bin/wbinfo -u")
- self.addCmdOutput("/usr/bin/testparm -s -v")
+ self.add_cmd_output("/usr/bin/wbinfo -g")
+ self.add_cmd_output("/usr/bin/wbinfo -u")
+ self.add_cmd_output("/usr/bin/testparm -s -v")
diff --git a/sos/plugins/sanlock.py b/sos/plugins/sanlock.py
index 298ca9ff..5c5d48fa 100644
--- a/sos/plugins/sanlock.py
+++ b/sos/plugins/sanlock.py
@@ -21,10 +21,10 @@ class sanlock(Plugin):
packages = [ "sanlock" ]
def setup(self):
- self.addCopySpec("/var/log/sanlock.log*")
- self.addCmdOutput("sanlock client status -D")
- self.addCmdOutput("sanlock client host_status -D")
- self.addCmdOutput("sanlock client log_dump")
+ self.add_copy_spec("/var/log/sanlock.log*")
+ self.add_cmd_output("sanlock client status -D")
+ self.add_cmd_output("sanlock client host_status -D")
+ self.add_cmd_output("sanlock client log_dump")
return
class RedHatSanlock(sanlock, RedHatPlugin):
@@ -33,4 +33,4 @@ class RedHatSanlock(sanlock, RedHatPlugin):
def setup(self):
super(RedHatSanlock, self).setup()
- self.addCopySpec("/etc/sysconfig/sanlock")
+ self.add_copy_spec("/etc/sysconfig/sanlock")
diff --git a/sos/plugins/sar.py b/sos/plugins/sar.py
index d3085ba6..5a00372e 100644
--- a/sos/plugins/sar.py
+++ b/sos/plugins/sar.py
@@ -40,18 +40,18 @@ class sar(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
# catch exceptions here to avoid races
try:
- dirList=os.listdir(self.sapath)
+ dir_list=os.listdir(self.sapath)
except Exception, e:
self.soslog.error("sar path %s cannot be read: %s"
% (self.sapath, e))
return
# find all the sa file that don't have an existing sar file
- for fname in dirList:
+ for fname in dir_list:
if fname[0:2] == 'sa' and fname[2] != 'r':
sar_filename = 'sar' + fname[2:4]
- if sar_filename not in dirList:
+ if sar_filename not in dir_list:
sar_command = "/bin/sh -c \"LANG=C /usr/bin/sar " \
+ "-A -f /var/log/sa/" + fname + "\""
- self.addCmdOutput(sar_command, sar_filename)
- self.addCopySpec("/var/log/sa/sar*")
+ self.add_cmd_output(sar_command, sar_filename)
+ self.add_copy_spec("/var/log/sa/sar*")
diff --git a/sos/plugins/selinux.py b/sos/plugins/selinux.py
index ca7d4c9c..0d3c6d3a 100644
--- a/sos/plugins/selinux.py
+++ b/sos/plugins/selinux.py
@@ -17,30 +17,30 @@ from sos.plugins import Plugin, RedHatPlugin
class selinux(Plugin, RedHatPlugin):
"""selinux related information
"""
- optionList = [("fixfiles", 'Print incorrect file context labels', 'slow', False)]
+ option_list = [("fixfiles", 'Print incorrect file context labels', 'slow', False)]
def setup(self):
- # sestatus is always collected in checkenabled()
- self.addCopySpec("/etc/selinux")
- self.addCmdOutput("/usr/bin/selinuxconfig")
- if self.getOption('fixfiles'):
- self.addCmdOutput("/sbin/fixfiles check")
- self.addForbiddenPath("/etc/selinux/targeted")
+ # sestatus is always collected in check_enabled()
+ self.add_copy_spec("/etc/selinux")
+ self.add_cmd_output("/usr/bin/selinuxconfig")
+ if self.get_option('fixfiles'):
+ self.add_cmd_output("/sbin/fixfiles check")
+ self.add_forbidden_path("/etc/selinux/targeted")
- if not self.policy().pkgByName('setroubleshoot'):
+ if not self.policy().pkg_by_name('setroubleshoot'):
return
# Check for SELinux denials and capture raw output from sealert
- if self.policy().runlevelDefault() in self.policy().runlevelByService("setroubleshoot"):
+ if self.policy().default_runlevel() in self.policy().runlevel_by_service("setroubleshoot"):
# TODO: fixup regex for more precise matching
- sealert=doRegexFindAll(r"^.*setroubleshoot:.*(sealert\s-l\s.*)","/var/log/messages")
+ sealert=do_regex_find_all(r"^.*setroubleshoot:.*(sealert\s-l\s.*)","/var/log/messages")
if sealert:
for i in sealert:
- self.addCmdOutput("%s" % i)
- self.addAlert("There are numerous selinux errors present and "+
+ self.add_cmd_output("%s" % i)
+ self.add_alert("There are numerous selinux errors present and "+
"possible fixes stated in the sealert output.")
- def checkenabled(self):
+ def check_enabled(self):
try:
- if self.getCmdOutputNow("/usr/sbin/sestatus", root_symlink = "sestatus").split(":")[1].strip() == "disabled":
+ if self.get_cmd_output_now("/usr/sbin/sestatus", root_symlink = "sestatus").split(":")[1].strip() == "disabled":
return False
except:
pass
diff --git a/sos/plugins/sendmail.py b/sos/plugins/sendmail.py
index c94d97ab..1b52a6af 100644
--- a/sos/plugins/sendmail.py
+++ b/sos/plugins/sendmail.py
@@ -25,4 +25,4 @@ class sendmail(Plugin, RedHatPlugin):
packages = ('sendmail',)
def setup(self):
- self.addCopySpecs(["/etc/mail/*", "/var/log/maillog"])
+ self.add_copy_specs(["/etc/mail/*", "/var/log/maillog"])
diff --git a/sos/plugins/smartcard.py b/sos/plugins/smartcard.py
index b675f3f5..0488f019 100644
--- a/sos/plugins/smartcard.py
+++ b/sos/plugins/smartcard.py
@@ -26,10 +26,10 @@ class smartcard(Plugin, RedHatPlugin):
packages = ('pam_pkcs11',)
def setup(self):
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/reader.conf",
"/etc/reader.conf.d/",
"/etc/pam_pkcs11/"])
- self.addCmdOutput("/usr/bin/pkcs11_inspect debug")
- self.addCmdOutput("/usr/bin/pklogin_finder debug")
- self.addCmdOutput("/bin/ls -nl /usr/lib*/pam_pkcs11/")
+ self.add_cmd_output("/usr/bin/pkcs11_inspect debug")
+ self.add_cmd_output("/usr/bin/pklogin_finder debug")
+ self.add_cmd_output("/bin/ls -nl /usr/lib*/pam_pkcs11/")
diff --git a/sos/plugins/snmp.py b/sos/plugins/snmp.py
index 4e01add8..63aac8e6 100644
--- a/sos/plugins/snmp.py
+++ b/sos/plugins/snmp.py
@@ -25,4 +25,4 @@ class snmp(Plugin, RedHatPlugin):
packages = ('net-snmp',)
def setup(self):
- self.addCopySpec("/etc/snmp")
+ self.add_copy_spec("/etc/snmp")
diff --git a/sos/plugins/soundcard.py b/sos/plugins/soundcard.py
index 2abd6886..c52c57c4 100644
--- a/sos/plugins/soundcard.py
+++ b/sos/plugins/soundcard.py
@@ -19,16 +19,16 @@ class soundcard(Plugin, RedHatPlugin):
""" Sound card information
"""
- def defaultenabled(self):
+ def default_enabled(self):
return False
def setup(self):
- self.addCopySpecs([
+ self.add_copy_specs([
"/proc/asound/*",
"/etc/alsa/*",
"/etc/asound.*"])
- self.addCmdOutput("/sbin/lspci | grep -i audio")
- self.addCmdOutput("/usr/bin/aplay -l")
- self.addCmdOutput("/usr/bin/aplay -L")
- self.addCmdOutput("/usr/bin/amixer")
- self.addCmdOutput("/sbin/lsmod | /bin/grep snd | /bin/awk '{print $1}'", suggest_filename = "sndmodules_loaded")
+ self.add_cmd_output("/sbin/lspci | grep -i audio")
+ self.add_cmd_output("/usr/bin/aplay -l")
+ self.add_cmd_output("/usr/bin/aplay -L")
+ self.add_cmd_output("/usr/bin/amixer")
+ self.add_cmd_output("/sbin/lsmod | /bin/grep snd | /bin/awk '{print $1}'", suggest_filename = "sndmodules_loaded")
diff --git a/sos/plugins/squid.py b/sos/plugins/squid.py
index df18661b..a83c45a1 100644
--- a/sos/plugins/squid.py
+++ b/sos/plugins/squid.py
@@ -23,4 +23,4 @@ class squid(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
packages = ('squid',)
def setup(self):
- self.addCopySpec("/etc/squid/squid.conf")
+ self.add_copy_spec("/etc/squid/squid.conf")
diff --git a/sos/plugins/ssh.py b/sos/plugins/ssh.py
index c925c567..35ce3598 100644
--- a/sos/plugins/ssh.py
+++ b/sos/plugins/ssh.py
@@ -20,4 +20,4 @@ class ssh(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""ssh-related information
"""
def setup(self):
- self.addCopySpecs(["/etc/ssh/ssh_config", "/etc/ssh/sshd_config"])
+ self.add_copy_specs(["/etc/ssh/ssh_config", "/etc/ssh/sshd_config"])
diff --git a/sos/plugins/sssd.py b/sos/plugins/sssd.py
index fae9b8b7..a5c3af72 100644
--- a/sos/plugins/sssd.py
+++ b/sos/plugins/sssd.py
@@ -24,7 +24,7 @@ class sssd(Plugin):
packages = ('sssd',)
def setup(self):
- self.addCopySpecs(["/etc/sssd", "/var/log/sssd/*"])
+ self.add_copy_specs(["/etc/sssd", "/var/log/sssd/*"])
class RedHatSssd(sssd, RedHatPlugin):
"""sssd-related Diagnostic Information on Red Hat based distributions
@@ -39,4 +39,4 @@ class DebianSssd(sssd, DebianPlugin, UbuntuPlugin):
def setup(self):
super(DebianSssd, self).setup()
- self.addCopySpecs(["/etc/default/sssd"])
+ self.add_copy_specs(["/etc/default/sssd"])
diff --git a/sos/plugins/startup.py b/sos/plugins/startup.py
index dcd7ac83..70f8966a 100644
--- a/sos/plugins/startup.py
+++ b/sos/plugins/startup.py
@@ -18,11 +18,11 @@ class startup(Plugin, RedHatPlugin):
"""startup information
"""
- optionList = [("servicestatus", "get a status of all running services", "slow", False)]
+ option_list = [("servicestatus", "get a status of all running services", "slow", False)]
def setup(self):
- self.addCopySpec("/etc/rc.d")
+ self.add_copy_spec("/etc/rc.d")
- self.addCmdOutput("/sbin/chkconfig --list", root_symlink = "chkconfig")
- if self.getOption('servicestatus'):
- self.addCmdOutput("/sbin/service --status-all")
- self.addCmdOutput("/sbin/runlevel")
+ self.add_cmd_output("/sbin/chkconfig --list", root_symlink = "chkconfig")
+ if self.get_option('servicestatus'):
+ self.add_cmd_output("/sbin/service --status-all")
+ self.add_cmd_output("/sbin/runlevel")
diff --git a/sos/plugins/sunrpc.py b/sos/plugins/sunrpc.py
index 3d45ac50..a59fa678 100644
--- a/sos/plugins/sunrpc.py
+++ b/sos/plugins/sunrpc.py
@@ -23,14 +23,14 @@ class sunrpc(Plugin):
plugin_name = "sunrpc"
service = None
- def checkenabled(self):
- if self.policy().runlevelDefault() in \
- self.policy().runlevelByService(self.service):
+ def check_enabled(self):
+ if self.policy().default_runlevel() in \
+ self.policy().runlevel_by_service(self.service):
return True
return False
def setup(self):
- self.addCmdOutput("/usr/sbin/rpcinfo -p localhost")
+ self.add_cmd_output("/usr/sbin/rpcinfo -p localhost")
return
class RedHatSunrpc(sunrpc, RedHatPlugin):
@@ -39,7 +39,7 @@ class RedHatSunrpc(sunrpc, RedHatPlugin):
service = 'rpcbind'
-# FIXME: depends on addition of runlevelByService (or similar)
+# FIXME: depends on addition of runlevel_by_service (or similar)
# in Debian/Ubuntu policy classes
#class DebianSunrpc(sunrpc, DebianPlugin, UbuntuPlugin):
# """Sun RPC related information for Red Hat systems
@@ -48,7 +48,7 @@ class RedHatSunrpc(sunrpc, RedHatPlugin):
# service = 'rpcbind-boot'
#
# def setup(self):
-# self.addCmdOutput("/usr/sbin/rpcinfo -p localhost")
+# self.add_cmd_output("/usr/sbin/rpcinfo -p localhost")
# return
diff --git a/sos/plugins/system.py b/sos/plugins/system.py
index 3033bd22..f9e1e4d5 100644
--- a/sos/plugins/system.py
+++ b/sos/plugins/system.py
@@ -21,7 +21,7 @@ class RedHatSystem(system, RedHatPlugin):
"""core system related information
"""
def setup(self):
- self.addCopySpecs([
+ self.add_copy_specs([
"/proc/sys",
"/etc/cron*",
"/etc/anacrontab",
@@ -32,28 +32,28 @@ class RedHatSystem(system, RedHatPlugin):
"/etc/ntp.conf",
"/etc/ntp/step-tickers",
"/etc/ntp/ntpservers"])
- self.addForbiddenPath(
+ self.add_forbidden_path(
"/proc/sys/net/ipv8/neigh/*/retrans_time")
- self.addForbiddenPath(
+ self.add_forbidden_path(
"/proc/sys/net/ipv6/neigh/*/base_reachable_time")
- self.addCmdOutput("/usr/bin/crontab -l")
+ self.add_cmd_output("/usr/bin/crontab -l")
class DebianSystem(system, DebianPlugin, UbuntuPlugin):
"""core system related information for Debian and Ubuntu
"""
def setup(self):
- self.addCopySpecs([
+ self.add_copy_specs([
"/proc/sys",
"/etc/cron*",
"/var/spool/cron*",
"/etc/syslog.conf",
"/etc/rsyslog.conf",
"/etc/ntp.conf" ])
- self.addForbiddenPath(
+ self.add_forbidden_path(
"/proc/sys/net/ipv8/neigh/*/retrans_time")
- self.addForbiddenPath(
+ self.add_forbidden_path(
"/proc/sys/net/ipv6/neigh/*/base_reachable_time")
- self.addCmdOutput("/usr/bin/crontab -l")
+ self.add_cmd_output("/usr/bin/crontab -l")
diff --git a/sos/plugins/systemd.py b/sos/plugins/systemd.py
index b9c2434b..84a3e759 100644
--- a/sos/plugins/systemd.py
+++ b/sos/plugins/systemd.py
@@ -27,21 +27,21 @@ class systemd(Plugin, RedHatPlugin):
files = ('/usr/lib/systemd/systemd',)
def setup(self):
- self.addCmdOutput("systemctl show --all")
- self.addCmdOutput("systemctl list-units --failed")
- self.addCmdOutput("systemctl list-unit-files")
- self.addCmdOutput("systemctl list-units --all")
- self.addCmdOutput("systemctl dump")
- self.addCmdOutput("systemd-delta")
- self.addCmdOutput("journalctl --verify")
- self.addCmdOutput("journalctl --all --this-boot --no-pager")
- self.addCmdOutput("journalctl --all --this-boot --no-pager -o verbose")
- self.addCmdOutput("ls -l /lib/systemd")
- self.addCmdOutput("ls -l /lib/systemd/system-shutdown")
- self.addCmdOutput("ls -l /lib/systemd/system-generators")
- self.addCmdOutput("ls -l /lib/systemd/user-generators")
-
- self.addCopySpecs(["/etc/systemd",
+ self.add_cmd_output("systemctl show --all")
+ self.add_cmd_output("systemctl list-units --failed")
+ self.add_cmd_output("systemctl list-unit-files")
+ self.add_cmd_output("systemctl list-units --all")
+ self.add_cmd_output("systemctl dump")
+ self.add_cmd_output("systemd-delta")
+ self.add_cmd_output("journalctl --verify")
+ self.add_cmd_output("journalctl --all --this-boot --no-pager")
+ self.add_cmd_output("journalctl --all --this-boot --no-pager -o verbose")
+ self.add_cmd_output("ls -l /lib/systemd")
+ self.add_cmd_output("ls -l /lib/systemd/system-shutdown")
+ self.add_cmd_output("ls -l /lib/systemd/system-generators")
+ self.add_cmd_output("ls -l /lib/systemd/user-generators")
+
+ self.add_copy_specs(["/etc/systemd",
"/lib/systemd/system",
"/lib/systemd/user",
"/etc/vconsole.conf",
diff --git a/sos/plugins/systemtap.py b/sos/plugins/systemtap.py
index cd3634ec..23ccddc1 100644
--- a/sos/plugins/systemtap.py
+++ b/sos/plugins/systemtap.py
@@ -24,5 +24,5 @@ class systemtap(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
packages = ('systemtap', 'systemtap-runtime')
def setup(self):
- self.addCmdOutput("/usr/bin/stap -V 2")
- self.addCmdOutput("/bin/uname -r")
+ self.add_cmd_output("/usr/bin/stap -V 2")
+ self.add_cmd_output("/bin/uname -r")
diff --git a/sos/plugins/sysvipc.py b/sos/plugins/sysvipc.py
index 4294978c..8cb3b4aa 100644
--- a/sos/plugins/sysvipc.py
+++ b/sos/plugins/sysvipc.py
@@ -22,8 +22,8 @@ class sysvipc(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
plugin_name = "sysvipc"
def setup(self):
- self.addCopySpecs([
+ self.add_copy_specs([
"/proc/sysvipc/msg",
"/proc/sysvipc/sem",
"/proc/sysvipc/shm"])
- self.addCmdOutput("/usr/bin/ipcs")
+ self.add_cmd_output("/usr/bin/ipcs")
diff --git a/sos/plugins/tftpserver.py b/sos/plugins/tftpserver.py
index e39bf0fe..9374642d 100644
--- a/sos/plugins/tftpserver.py
+++ b/sos/plugins/tftpserver.py
@@ -25,4 +25,4 @@ class tftpserver(Plugin, RedHatPlugin):
packages = ('tftp-server',)
def setup(self):
- self.addCmdOutput("/bin/ls -lanR /tftpboot")
+ self.add_cmd_output("/bin/ls -lanR /tftpboot")
diff --git a/sos/plugins/tomcat.py b/sos/plugins/tomcat.py
index f447f543..c188f848 100644
--- a/sos/plugins/tomcat.py
+++ b/sos/plugins/tomcat.py
@@ -21,4 +21,4 @@ class tomcat(Plugin, RedHatPlugin):
packages = ('tomcat5',)
def setup(self):
- self.addCopySpecs(["/etc/tomcat5", "/var/log/tomcat5"])
+ self.add_copy_specs(["/etc/tomcat5", "/var/log/tomcat5"])
diff --git a/sos/plugins/udev.py b/sos/plugins/udev.py
index cb3aa97d..c5981fc3 100644
--- a/sos/plugins/udev.py
+++ b/sos/plugins/udev.py
@@ -18,4 +18,4 @@ class udev(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""udev related information
"""
def setup(self):
- self.addCopySpecs(["/etc/udev/udev.conf", "/etc/udev/rules.d/*"])
+ self.add_copy_specs(["/etc/udev/udev.conf", "/etc/udev/rules.d/*"])
diff --git a/sos/plugins/veritas.py b/sos/plugins/veritas.py
index 95564579..03eda211 100644
--- a/sos/plugins/veritas.py
+++ b/sos/plugins/veritas.py
@@ -20,19 +20,19 @@ class veritas(Plugin, RedHatPlugin):
"""
# Information about VRTSexplorer obtained from
# http://seer.entsupport.symantec.com/docs/243150.htm
- optionList = [("script", "Define VRTSexplorer script path", "", "/opt/VRTSspt/VRTSexplorer")]
+ option_list = [("script", "Define VRTSexplorer script path", "", "/opt/VRTSspt/VRTSexplorer")]
- def checkenabled(self):
- return os.path.isfile(self.getOption("script"))
+ def check_enabled(self):
+ return os.path.isfile(self.get_option("script"))
def setup(self):
""" interface with vrtsexplorer to capture veritas related data """
- stat, out, runtime = self.callExtProg(self.getOption("script"))
+ stat, out, runtime = self.call_ext_prog(self.get_option("script"))
try:
for line in out.readlines():
line = line.strip()
- tarfile = self.doRegexFindAll(r"ftp (.*tar.gz)", line)
+ tarfile = self.do_regex_find_all(r"ftp (.*tar.gz)", line)
if len(tarfile) == 1:
- self.addCopySpec(tarfile[0])
+ self.add_copy_spec(tarfile[0])
except AttributeError, e:
- self.addAlert(e)
+ self.add_alert(e)
diff --git a/sos/plugins/vmware.py b/sos/plugins/vmware.py
index e75b5a91..7836c7e8 100644
--- a/sos/plugins/vmware.py
+++ b/sos/plugins/vmware.py
@@ -22,7 +22,7 @@ class vmware(Plugin, RedHatPlugin):
files = ('/usr/bin/vmware','/usr/init.d/vmware-tools')
def setup(self):
- self.addCmdOutput("/usr/bin/vmware -v")
- self.addCopySpecs(["/etc/vmware/locations",
+ self.add_cmd_output("/usr/bin/vmware -v")
+ self.add_copy_specs(["/etc/vmware/locations",
"/etc/vmware/config",
"/proc/vmmemctl"])
diff --git a/sos/plugins/x11.py b/sos/plugins/x11.py
index a760e6bc..2f25cb29 100644
--- a/sos/plugins/x11.py
+++ b/sos/plugins/x11.py
@@ -21,10 +21,10 @@ class x11(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
files = ('/etc/X11',)
def setup(self):
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/X11",
"/var/log/Xorg.*.log",
"/var/log/XFree86.*.log",
])
- self.addForbiddenPath("/etc/X11/X")
- self.addForbiddenPath("/etc/X11/fontpath.d")
+ self.add_forbidden_path("/etc/X11/X")
+ self.add_forbidden_path("/etc/X11/fontpath.d")
diff --git a/sos/plugins/xen.py b/sos/plugins/xen.py
index 7a168709..a8b1110e 100644
--- a/sos/plugins/xen.py
+++ b/sos/plugins/xen.py
@@ -20,71 +20,71 @@ from stat import *
class xen(Plugin, RedHatPlugin):
"""Xen related information
"""
- def determineXenHost(self):
+ def determine_xen_host(self):
if os.access("/proc/acpi/dsdt", os.R_OK):
- (status, output, rtime) = self.callExtProg("grep -qi xen /proc/acpi/dsdt")
+ (status, output, rtime) = self.call_ext_prog("grep -qi xen /proc/acpi/dsdt")
if status == 0:
return "hvm"
if os.access("/proc/xen/capabilities", os.R_OK):
- (status, output, rtime) = self.callExtProg("grep -q control_d /proc/xen/capabilities")
+ (status, output, rtime) = self.call_ext_prog("grep -q control_d /proc/xen/capabilities")
if status == 0:
return "dom0"
else:
return "domU"
return "baremetal"
- def checkenabled(self):
- return (self.determineXenHost() == "baremetal")
+ def check_enabled(self):
+ return (self.determine_xen_host() == "baremetal")
def is_running_xenstored(self):
xs_pid = os.popen("pidof xenstored").read()
xs_pidnum = re.split('\n$',xs_pid)[0]
return xs_pidnum.isdigit()
- def domCollectProc(self):
- self.addCopySpecs([
+ def dom_collect_proc(self):
+ self.add_copy_specs([
"/proc/xen/balloon",
"/proc/xen/capabilities",
"/proc/xen/xsd_kva",
"/proc/xen/xsd_port"])
# determine if CPU has PAE support
- self.addCmdOutput("/bin/grep pae /proc/cpuinfo")
+ self.add_cmd_output("/bin/grep pae /proc/cpuinfo")
# determine if CPU has Intel-VT or AMD-V support
- self.addCmdOutput("/bin/egrep -e 'vmx|svm' /proc/cpuinfo")
+ self.add_cmd_output("/bin/egrep -e 'vmx|svm' /proc/cpuinfo")
def setup(self):
- host_type = self.determineXenHost()
+ host_type = self.determine_xen_host()
if host_type == "domU":
# we should collect /proc/xen and /sys/hypervisor
- self.domCollectProc()
+ self.dom_collect_proc()
# determine if hardware virtualization support is enabled
# in BIOS: /sys/hypervisor/properties/capabilities
- self.addCopySpec("/sys/hypervisor")
+ self.add_copy_spec("/sys/hypervisor")
elif host_type == "hvm":
# what do we collect here???
pass
elif host_type == "dom0":
# default of dom0, collect lots of system information
- self.addCopySpecs([
+ self.add_copy_specs([
"/var/log/xen",
"/etc/xen",
"/sys/hypervisor/version",
"/sys/hypervisor/compilation",
"/sys/hypervisor/properties",
"/sys/hypervisor/type"])
- self.addCmdOutput("/usr/sbin/xm dmesg")
- self.addCmdOutput("/usr/sbin/xm info")
- self.addCmdOutput("/usr/sbin/xm list")
- self.addCmdOutput("/usr/sbin/xm list --long")
- self.addCmdOutput("/usr/sbin/brctl show")
- self.domCollectProc()
+ self.add_cmd_output("/usr/sbin/xm dmesg")
+ self.add_cmd_output("/usr/sbin/xm info")
+ self.add_cmd_output("/usr/sbin/xm list")
+ self.add_cmd_output("/usr/sbin/xm list --long")
+ self.add_cmd_output("/usr/sbin/brctl show")
+ self.dom_collect_proc()
if self.is_running_xenstored():
- self.addCopySpec("/sys/hypervisor/uuid")
- self.addCmdOutput("/usr/bin/xenstore-ls")
+ self.add_copy_spec("/sys/hypervisor/uuid")
+ self.add_cmd_output("/usr/bin/xenstore-ls")
else:
# we need tdb instead of xenstore-ls if cannot get it.
- self.addCopySpec("/var/lib/xenstored/tdb")
+ self.add_copy_spec("/var/lib/xenstored/tdb")
# FIXME: we *might* want to collect things in /sys/bus/xen*,
# /sys/class/xen*, /sys/devices/xen*, /sys/modules/blk*,
@@ -94,4 +94,4 @@ class xen(Plugin, RedHatPlugin):
# for bare-metal, we don't have to do anything special
return #USEFUL
- self.addCustomText("Xen hostType: "+host_type)
+ self.add_custom_text("Xen hostType: "+host_type)
diff --git a/sos/plugins/xinetd.py b/sos/plugins/xinetd.py
index ba9e1c8d..5c76bd1c 100644
--- a/sos/plugins/xinetd.py
+++ b/sos/plugins/xinetd.py
@@ -25,5 +25,5 @@ class xinetd(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
packages = ('xinetd',)
def setup(self):
- self.addCopySpec("/etc/xinetd.conf")
- self.addCopySpec("/etc/xinetd.d")
+ self.add_copy_spec("/etc/xinetd.conf")
+ self.add_copy_spec("/etc/xinetd.d")
diff --git a/sos/plugins/yum.py b/sos/plugins/yum.py
index 4120d50b..17684f21 100644
--- a/sos/plugins/yum.py
+++ b/sos/plugins/yum.py
@@ -21,44 +21,44 @@ class yum(Plugin, RedHatPlugin):
files = ('/etc/yum.conf',)
packages = ('yum',)
- optionList = [("yumlist", "list repositories and packages", "slow", False),
+ option_list = [("yumlist", "list repositories and packages", "slow", False),
("yumdebug", "gather yum debugging data", "slow", False)]
def setup(self):
- rhelver = self.policy().rhelVersion()
+ rhelver = self.policy().rhel_version()
# Pull all yum related information
- self.addCopySpecs([
+ self.add_copy_specs([
"/etc/yum",
"/etc/yum.repos.d",
"/etc/yum.conf",
"/var/log/yum.log"])
# Get a list of channels the machine is subscribed to.
- self.addCmdOutput("/usr/bin/yum -C repolist")
+ self.add_cmd_output("/usr/bin/yum -C repolist")
# candlepin info
- self.addForbiddenPath("/etc/pki/entitlements/key.pem")
- self.addForbiddenPath("/etc/pki/entitlements/*-key.pem")
- self.addCopySpecs([
+ self.add_forbidden_path("/etc/pki/entitlements/key.pem")
+ self.add_forbidden_path("/etc/pki/entitlements/*-key.pem")
+ self.add_copy_specs([
"/etc/pki/product/*.pem",
"/etc/pki/consumer/cert.pem",
"/etc/pki/entitlement/*.pem",
"/etc/rhsm/",
"/var/log/rhsm/rhsm.log",
"/var/log/rhsm/rhsmcertd.log"])
- self.addCmdOutput("subscription-manager list --installed")
- self.addCmdOutput("subscription-manager list --consumed")
+ self.add_cmd_output("subscription-manager list --installed")
+ self.add_cmd_output("subscription-manager list --consumed")
- if self.getOption("yumlist"):
+ if self.get_option("yumlist"):
# List various information about available packages
- self.addCmdOutput("/usr/bin/yum list")
+ self.add_cmd_output("/usr/bin/yum list")
- if self.getOption("yumdebug") and self.isInstalled('yum-utils'):
+ if self.get_option("yumdebug") and self.is_installed('yum-utils'):
# RHEL6+ alternative for this whole function:
- # self.addCmdOutput("/usr/bin/yum-debug-dump '%s'" % os.path.join(self.cInfo['dstroot'],"yum-debug-dump"))
- ret, output, rtime = self.callExtProg("/usr/bin/yum-debug-dump")
+ # self.add_cmd_output("/usr/bin/yum-debug-dump '%s'" % os.path.join(self.commons['dstroot'],"yum-debug-dump"))
+ ret, output, rtime = self.call_ext_prog("/usr/bin/yum-debug-dump")
try:
- self.addCmdOutput("/bin/zcat %s" % (output.split()[-1],))
+ self.add_cmd_output("/bin/zcat %s" % (output.split()[-1],))
except IndexError:
pass
diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py
index 224abdd8..d99207ba 100644
--- a/sos/policies/__init__.py
+++ b/sos/policies/__init__.py
@@ -45,7 +45,7 @@ class PackageManager(object):
format:
package name|package.version\n
- You may also subclass this class and provide a getPackageList method to
+ You may also subclass this class and provide a get_pkg_list method to
build the list of packages and versions.
"""
@@ -56,30 +56,30 @@ class PackageManager(object):
if query_command:
self.query_command = query_command
- def allPkgsByName(self, name):
+ def all_pkgs_by_name(self, name):
"""
Return a list of packages that match name.
"""
- return fnmatch.filter(self.allPkgs().keys(), name)
+ return fnmatch.filter(self.all_pkgs().keys(), name)
- def allPkgsByNameRegex(self, regex_name, flags=0):
+ def all_pkgs_by_name_regex(self, regex_name, flags=0):
"""
Return a list of packages that match regex_name.
"""
reg = re.compile(regex_name, flags)
- return [pkg for pkg in self.allPkgs().keys() if reg.match(pkg)]
+ return [pkg for pkg in self.all_pkgs().keys() if reg.match(pkg)]
- def pkgByName(self, name):
+ def pkg_by_name(self, name):
"""
Return a single package that matches name.
"""
- pkgmatches = self.allPkgsByName(name)
+ pkgmatches = self.all_pkgs_by_name(name)
if (len(pkgmatches) != 0):
- return self.allPkgsByName(name)[-1]
+ return self.all_pkgs_by_name(name)[-1]
else:
return None
- def getPackageList(self):
+ def get_pkg_list(self):
"""
returns a dictionary of packages in the following format:
{'package_name': {'name': 'package_name', 'version': 'major.minor.version'}}
@@ -95,15 +95,15 @@ class PackageManager(object):
return self.packages
- def allPkgs(self):
+ def all_pkgs(self):
"""
Return a list of all packages.
"""
if not self.packages:
- self.packages = self.getPackageList()
+ self.packages = self.get_pkg_list()
return self.packages
- def pkgNVRA(self, pkg):
+ def pkg_nvra(self, pkg):
fields = pkg.split("-")
version, release, arch = fields[-3:]
name = "-".join(fields[:-3])
@@ -139,8 +139,8 @@ No changes will be made to system configuration.
super() to ensure that they get the required platform bits attached.
super(SubClass, self).__init__()"""
self._parse_uname()
- self.reportName = self.hostname
- self.ticketNumber = None
+ self.report_name = self.hostname
+ self.ticket_number = None
self.package_manager = PackageManager()
self._valid_subclasses = []
@@ -165,21 +165,21 @@ No changes will be made to system configuration.
"""
return False
- def preferedArchive(self):
+ def preferred_archive_name(self):
"""
Return the class object of the prefered archive format for this platform
"""
from sos.archive import TarFileArchive
return TarFileArchive
- def getArchiveName(self):
+ def get_archive_name(self):
"""
This function should return the filename of the archive without the
extension.
"""
- if self.ticketNumber:
- self.reportName += "." + self.ticketNumber
- return "sosreport-%s-%s" % (self.reportName, time.strftime("%Y%m%d%H%M%S"))
+ if self.ticket_number:
+ self.report_name += "." + self.ticket_number
+ return "sosreport-%s-%s" % (self.report_name, time.strftime("%Y%m%d%H%M%S"))
def validatePlugin(self, plugin_class):
"""
@@ -188,26 +188,26 @@ No changes will be made to system configuration.
valid_subclasses = [IndependentPlugin] + self.valid_subclasses
return any(issubclass(plugin_class, class_) for class_ in valid_subclasses)
- def preWork(self):
+ def pre_work(self):
"""
This function is called prior to collection.
"""
pass
- def packageResults(self, package_name):
+ def package_results(self, package_name):
"""
This function is called prior to packaging.
"""
pass
- def postWork(self):
+ def post_work(self):
"""
This function is called after the sosreport has been generated.
"""
pass
- def pkgByName(self, pkg):
- return self.package_manager.pkgByName(pkg)
+ def pkg_by_name(self, pkg):
+ return self.package_manager.pkg_by_name(pkg)
def _parse_uname(self):
(system, node, release,
@@ -218,7 +218,7 @@ No changes will be made to system configuration.
self.smp = version.split()[1] == "SMP"
self.machine = machine
- def setCommons(self, commons):
+ def set_commons(self, commons):
self.commons = commons
def is_root(self):
@@ -236,12 +236,12 @@ No changes will be made to system configuration.
archive_fp.close()
return digest.hexdigest()
- def getPreferredHashAlgorithm(self):
+ def get_preferred_hash_algorithm(self):
"""Returns the string name of the hashlib-supported checksum algorithm
to use"""
return "md5"
- def displayResults(self, final_filename=None):
+ def display_results(self, final_filename=None):
# make sure a report exists
if not final_filename:
@@ -263,7 +263,7 @@ No changes will be made to system configuration.
self._print(_("Please send this file to your support representative."))
self._print()
- def uploadResults(self, final_filename):
+ def upload_results(self, final_filename):
# make sure a report exists
if not final_filename:
@@ -381,7 +381,7 @@ class LinuxPolicy(Policy):
def __init__(self):
super(LinuxPolicy, self).__init__()
- def getPreferredHashAlgorithm(self):
+ def get_preferred_hash_algorithm(self):
checksum = "md5"
try:
fp = open("/proc/sys/crypto/fips_enabled", "r")
@@ -394,7 +394,7 @@ class LinuxPolicy(Policy):
fp.close()
return checksum
- def runlevelDefault(self):
+ def default_runlevel(self):
try:
with open("/etc/inittab") as fp:
pattern = r"id:(\d{1}):initdefault:"
@@ -403,60 +403,60 @@ class LinuxPolicy(Policy):
except:
return 3
- def kernelVersion(self):
+ def kernel_version(self):
return self.release
- def hostName(self):
+ def host_name(self):
return self.hostname
- def isKernelSMP(self):
+ def is_kernel_smp(self):
return self.smp
- def getArch(self):
+ def get_arch(self):
return self.machine
- def getLocalName(self):
- """Returns the name usd in the preWork step"""
- return self.hostName()
+ def get_local_name(self):
+ """Returns the name usd in the pre_work step"""
+ return self.host_name()
- def sanitizeReportName(self, report_name):
+ def sanitize_report_name(self, report_name):
return re.sub(r"[^-a-zA-Z.0-9]", "", report_name)
- def sanitizeTicketNumber(self, ticket_number):
+ def sanitize_ticket_number(self, ticket_number):
return re.sub(r"[^0-9]", "", ticket_number)
- def preWork(self):
+ def pre_work(self):
# this method will be called before the gathering begins
- localname = self.getLocalName()
+ localname = self.get_local_name()
if not self.commons['cmdlineopts'].batch and not self.commons['cmdlineopts'].quiet:
try:
- self.reportName = raw_input(_("Please enter your first initial and last name [%s]: ") % localname)
+ self.report_name = raw_input(_("Please enter your first initial and last name [%s]: ") % localname)
- self.ticketNumber = raw_input(_("Please enter the case number that you are generating this report for: "))
+ self.ticket_number = raw_input(_("Please enter the case number that you are generating this report for: "))
self._print()
except:
self._print()
sys.exit(0)
- if len(self.reportName) == 0:
- self.reportName = localname
+ if len(self.report_name) == 0:
+ self.report_name = localname
- if self.commons['cmdlineopts'].customerName:
- self.reportName = self.commons['cmdlineopts'].customerName
+ if self.commons['cmdlineopts'].customer_name:
+ self.report_name = self.commons['cmdlineopts'].customer_name
- if self.commons['cmdlineopts'].ticketNumber:
- self.ticketNumber = self.commons['cmdlineopts'].ticketNumber
+ if self.commons['cmdlineopts'].ticket_number:
+ self.ticket_number = self.commons['cmdlineopts'].ticket_number
- self.reportName = self.sanitizeReportName(self.reportName)
- if self.ticketNumber:
- self.ticketNumber = self.sanitizeTicketNumber(self.ticketNumber)
+ self.report_name = self.sanitize_report_name(self.report_name)
+ if self.ticket_number:
+ self.ticket_number = self.sanitize_ticket_number(self.ticket_number)
- if (self.reportName == ""):
- self.reportName = "default"
+ if (self.report_name == ""):
+ self.report_name = "default"
return
- def packageResults(self, archive_filename):
+ def package_results(self, archive_filename):
self._print(_("Creating compressed archive..."))
diff --git a/sos/policies/debian.py b/sos/policies/debian.py
index 98526e3a..94b089f3 100644
--- a/sos/policies/debian.py
+++ b/sos/policies/debian.py
@@ -7,8 +7,8 @@ class DebianPolicy(LinuxPolicy):
distro = "Debian"
vendor = "the Debian project"
vendor_url = "http://www.debian.org/"
- reportName = ""
- ticketNumber = ""
+ report_name = ""
+ ticket_number = ""
package_manager = PackageManager("dpkg-query -W -f='${Package}|${Version}\\n' \*")
valid_subclasses = [DebianPlugin]
diff --git a/sos/policies/redhat.py b/sos/policies/redhat.py
index 399db6f7..7677b806 100644
--- a/sos/policies/redhat.py
+++ b/sos/policies/redhat.py
@@ -38,8 +38,8 @@ class RedHatPolicy(LinuxPolicy):
def __init__(self):
super(RedHatPolicy, self).__init__()
- self.reportName = ""
- self.ticketNumber = ""
+ self.report_name = ""
+ self.ticket_number = ""
self.package_manager = PackageManager('rpm -qa --queryformat "%{NAME}|%{VERSION}\\n"')
self.valid_subclasses = [RedHatPlugin]
@@ -50,7 +50,7 @@ class RedHatPolicy(LinuxPolicy):
Red Hat distribution or False otherwise."""
return False
- def runlevelByService(self, name):
+ def runlevel_by_service(self, name):
from subprocess import Popen, PIPE
ret = []
p = Popen("LC_ALL=C /sbin/chkconfig --list %s" % name,
@@ -71,8 +71,8 @@ class RedHatPolicy(LinuxPolicy):
ret.append(int(runlevel))
return ret
- def getLocalName(self):
- return self.hostName()
+ def get_local_name(self):
+ return self.host_name()
class RHELPolicy(RedHatPolicy):
@@ -109,10 +109,10 @@ No changes will be made to system configuration.
return (os.path.isfile('/etc/redhat-release')
and not os.path.isfile('/etc/fedora-release'))
- def rhelVersion(self):
+ def rhel_version(self):
try:
- pkg = self.pkgByName("redhat-release") or \
- self.allPkgsByNameRegex("redhat-release-.*")[-1]
+ pkg = self.pkg_by_name("redhat-release") or \
+ self.all_pkgs_by_name_regex("redhat-release-.*")[-1]
pkgname = pkg["version"]
if pkgname[0] == "4":
return 4
@@ -124,7 +124,7 @@ No changes will be made to system configuration.
pass
return False
- def rhnUsername(self):
+ def rhn_username(self):
try:
cfg = config.initUp2dateConfig()
@@ -133,8 +133,8 @@ No changes will be made to system configuration.
# ignore any exception and return an empty username
return ""
- def getLocalName(self):
- return self.rhnUsername() or self.hostName()
+ def get_local_name(self):
+ return self.rhn_username() or self.host_name()
class FedoraPolicy(RedHatPolicy):
@@ -151,9 +151,9 @@ class FedoraPolicy(RedHatPolicy):
or False."""
return os.path.isfile('/etc/fedora-release')
- def fedoraVersion(self):
- pkg = self.pkgByName("fedora-release") or \
- self.allPkgsByNameRegex("fedora-release-.*")[-1]
+ def fedora_version(self):
+ pkg = self.pkg_by_name("fedora-release") or \
+ self.all_pkgs_by_name_regex("fedora-release-.*")[-1]
return int(pkg["version"])
# vim: ts=4 sw=4 et
diff --git a/sos/policies/windows.py b/sos/policies/windows.py
index 6b7b0e00..0424a3f0 100644
--- a/sos/policies/windows.py
+++ b/sos/policies/windows.py
@@ -40,6 +40,6 @@ class WindowsPolicy(Policy):
username = shell_out("echo %USERNAME%")
return username.strip() in admins
- def preferedArchive(self):
+ def preferred_archive_name(self):
from sos.archive import ZipFileArchive
return ZipFileArchive
diff --git a/sos/sosreport.py b/sos/sosreport.py
index b5691c05..37b7f67f 100644
--- a/sos/sosreport.py
+++ b/sos/sosreport.py
@@ -245,9 +245,9 @@ class SoSReport(object):
def _set_archive(self):
if self.opts.compression_type not in ('auto', 'zip', 'bzip2', 'gzip', 'xz'):
raise Exception("Invalid compression type specified. Options are: auto, zip, bzip2, gzip and xz")
- archive_name = os.path.join(self.opts.tmp_dir,self.policy.getArchiveName())
+ archive_name = os.path.join(self.opts.tmp_dir,self.policy.get_archive_name())
if self.opts.compression_type == 'auto':
- auto_archive = self.policy.preferedArchive()
+ auto_archive = self.policy.preferred_archive_name()
self.archive = auto_archive(archive_name)
elif self.opts.compression_type == 'zip':
self.archive = ZipFileArchive(archive_name)
@@ -391,12 +391,12 @@ class SoSReport(object):
plugin_name in self._get_disabled_plugins())
def _is_inactive(self, plugin_name, pluginClass):
- return (not pluginClass(self.get_commons()).checkenabled() and
+ return (not pluginClass(self.get_commons()).check_enabled() and
not plugin_name in self.opts.enableplugins and
not plugin_name in self.opts.onlyplugins)
def _is_not_default(self, plugin_name, pluginClass):
- return (not pluginClass(self.get_commons()).defaultenabled() and
+ return (not pluginClass(self.get_commons()).default_enabled() and
not plugin_name in self.opts.enableplugins and
not plugin_name in self.opts.onlyplugins)
@@ -472,7 +472,7 @@ class SoSReport(object):
def _set_all_options(self):
if self.opts.usealloptions:
for plugname, plug in self.loaded_plugins:
- for name, parms in zip(plug.optNames, plug.optParms):
+ for name, parms in zip(plug.opt_names, plug.opt_parms):
if type(parms["enabled"])==bool:
parms["enabled"] = True
@@ -518,7 +518,7 @@ class SoSReport(object):
for plugname, plug in self.loaded_plugins:
if plugname in opts:
for opt, val in opts[plugname]:
- if not plug.setOption(opt, val):
+ if not plug.set_option(opt, val):
self.soslog.error('no such option "%s" for plugin '
'(%s)' % (opt,plugname))
self._exit(1)
@@ -540,7 +540,7 @@ class SoSReport(object):
def _set_plugin_options(self):
for plugin_name, plugin in self.loaded_plugins:
- names, parms = plugin.getAllOptions()
+ names, parms = plugin.get_all_options()
for optname, optparm in zip(names, parms):
self.all_options.append((plugin, plugin_name, optname, optparm))
@@ -604,7 +604,7 @@ class SoSReport(object):
def prework(self):
try:
- self.policy.preWork()
+ self.policy.pre_work()
self._set_archive()
except Exception, e:
import traceback
@@ -636,7 +636,7 @@ class SoSReport(object):
self.archive.add_string(content="\n".join(versions), dest='version.txt')
- def copy_stuff(self):
+ def collect(self):
plugruncount = 0
for i in izip(self.loaded_plugins):
plugruncount += 1
@@ -645,7 +645,7 @@ class SoSReport(object):
sys.stdout.write("\r Running %d/%d: %s... " % (plugruncount, len(self.loaded_plugins), plugname))
sys.stdout.flush()
try:
- plug.copyStuff()
+ plug.collect()
except KeyboardInterrupt:
raise
except:
@@ -656,7 +656,7 @@ class SoSReport(object):
def report(self):
for plugname, plug in self.loaded_plugins:
- for oneFile in plug.copiedFiles:
+ for oneFile in plug.copied_files:
try:
self.xml_report.add_file(oneFile["srcpath"], os.stat(oneFile["srcpath"]))
except:
@@ -675,18 +675,18 @@ class SoSReport(object):
for alert in plug.alerts:
section.add(Alert(alert))
- if plug.customText:
- section.add(Note(plug.customText))
+ if plug.custom_text:
+ section.add(Note(plug.custom_text))
- for f in plug.copiedFiles:
+ for f in plug.copied_files:
section.add(CopiedFile(name=f['srcpath'],
href= ".." + f['dstpath']))
- for cmd in plug.executedCommands:
+ for cmd in plug.executed_commands:
section.add(Command(name=cmd['exe'], return_code=0,
href="../" + cmd['file']))
- for content, f in plug.copyStrings:
+ for content, f in plug.copy_strings:
section.add(CreatedFile(name=f))
report.add(section)
@@ -770,7 +770,7 @@ class SoSReport(object):
def final_work(self):
# package up the results for the support organization
- self.policy.packageResults(self.archive.name())
+ self.policy.package_results(self.archive.name())
self._finish_logging()
@@ -778,9 +778,9 @@ class SoSReport(object):
# automated submission will go here
if not self.opts.upload:
- self.policy.displayResults(final_filename)
+ self.policy.display_results(final_filename)
else:
- self.policy.uploadResults(final_filename)
+ self.policy.upload_results(final_filename)
self.tempfile_util.clean()
@@ -829,10 +829,10 @@ class SoSReport(object):
dest="debug",
help="enable interactive debugging using the python debugger")
parser.add_option("--ticket-number", action="store",
- dest="ticketNumber",
+ dest="ticket_number",
help="specify ticket number")
parser.add_option("--name", action="store",
- dest="customerName",
+ dest="customer_name",
help="specify report name")
parser.add_option("--config-file", action="store",
dest="config_file",
@@ -866,7 +866,7 @@ class SoSReport(object):
def execute(self):
try:
self._setup_logging()
- self.policy.setCommons(self.get_commons())
+ self.policy.set_commons(self.get_commons())
self.print_header()
self.load_plugins()
self._set_tunables()
@@ -885,7 +885,7 @@ class SoSReport(object):
self.ui_log.info(_(" Running plugins. Please wait ..."))
self.ui_log.info("")
- self.copy_stuff()
+ self.collect()
self.ui_log.info("")
diff --git a/sos/utilities.py b/sos/utilities.py
index 7995ef0f..ae4763df 100644
--- a/sos/utilities.py
+++ b/sos/utilities.py
@@ -82,7 +82,7 @@ def get_hash_name():
import sos.policies
policy = sos.policies.load()
try:
- name = policy.getPreferredHashAlgorithm()
+ name = policy.get_preferred_hash_algorithm()
hashlib.new(name)
return name
except:
@@ -143,7 +143,7 @@ def is_executable(command):
candidates = [command] + [os.path.join(p, command) for p in paths]
return any(os.access(path, os.X_OK) for path in candidates)
-def sosGetCommandOutput(command, timeout=300):
+def sos_get_command_output(command, timeout=300):
"""Execute a command through the system shell. First checks to see if the
requested command is executable. Returns (returncode, stdout, 0)"""
# XXX: what is this doing this for?
@@ -184,7 +184,7 @@ def import_module(module_fqname, superclasses=None):
def shell_out(cmd):
"""Uses subprocess.Popen to make a system call and returns stdout.
Does not handle exceptions."""
- return sosGetCommandOutput(cmd)[1]
+ return sos_get_command_output(cmd)[1]
class DirTree(object):
"""Builds an ascii representation of a directory structure"""
diff --git a/tests/option_tests.py b/tests/option_tests.py
index 03804dec..d221b965 100644
--- a/tests/option_tests.py
+++ b/tests/option_tests.py
@@ -15,20 +15,20 @@ class GlobalOptionTest(unittest.TestCase):
},
}
self.plugin = Plugin(self.commons)
- self.plugin.optNames = ['baz', 'empty']
- self.plugin.optParms = [{'enabled': False}, {'enabled': None}]
+ self.plugin.opt_names = ['baz', 'empty']
+ self.plugin.opt_parms = [{'enabled': False}, {'enabled': None}]
def test_simple_lookup(self):
- self.assertEquals(self.plugin.getOption('test_option'), 'foobar')
+ self.assertEquals(self.plugin.get_option('test_option'), 'foobar')
def test_multi_lookup(self):
- self.assertEquals(self.plugin.getOption(('not_there', 'test_option')), 'foobar')
+ self.assertEquals(self.plugin.get_option(('not_there', 'test_option')), 'foobar')
def test_cascade(self):
- self.assertEquals(self.plugin.getOption(('baz')), False)
+ self.assertEquals(self.plugin.get_option(('baz')), False)
def test_none_should_cascade(self):
- self.assertEquals(self.plugin.getOption(('empty', 'empty_global')), True)
+ self.assertEquals(self.plugin.get_option(('empty', 'empty_global')), True)
if __name__ == "__main__":
unittest.main()
diff --git a/tests/plugin_tests.py b/tests/plugin_tests.py
index f01a7a9c..09d4c2ac 100644
--- a/tests/plugin_tests.py
+++ b/tests/plugin_tests.py
@@ -3,7 +3,7 @@ import os
import tempfile
from StringIO import StringIO
-from sos.plugins import Plugin, regex_findall, sosRelPath, mangle_command
+from sos.plugins import Plugin, regex_findall, sos_relative_path, mangle_command
from sos.utilities import Archive
PATH = os.path.dirname(__file__)
@@ -50,7 +50,7 @@ class MockArchive(Archive):
class MockPlugin(Plugin):
- optionList = [("opt", 'an option', 'fast', None),
+ option_list = [("opt", 'an option', 'fast', None),
("opt2", 'another option', 'fast', False)]
def setup(self):
@@ -72,7 +72,7 @@ class ForbiddenMockPlugin(Plugin):
plugin_name = "forbidden"
def setup(self):
- self.addForbiddenPath("tests")
+ self.add_forbidden_path("tests")
class EnablerPlugin(Plugin):
@@ -114,17 +114,17 @@ class PluginToolTests(unittest.TestCase):
def test_rel_path(self):
path1 = "/usr/lib/foo"
path2 = "/usr/lib/boo"
- self.assertEquals(sosRelPath(path1, path2), "../boo")
+ self.assertEquals(sos_relative_path(path1, path2), "../boo")
def test_abs_path(self):
path1 = "usr/lib/foo"
path2 = "foo/lib/boo"
- self.assertEquals(sosRelPath(path1, path2), "foo/lib/boo")
+ self.assertEquals(sos_relative_path(path1, path2), "foo/lib/boo")
def test_bad_path(self):
path1 = None
path2 = "foo/lib/boo"
- self.assertEquals(sosRelPath(path1, path2), "foo/lib/boo")
+ self.assertEquals(sos_relative_path(path1, path2), "foo/lib/boo")
def test_mangle_command(self):
self.assertEquals("foo", mangle_command("/usr/bin/foo"))
@@ -161,27 +161,27 @@ class PluginTests(unittest.TestCase):
def test_set_plugin_option(self):
p = MockPlugin({})
- p.setOption("opt", "testing")
- self.assertEquals(p.getOption("opt"), "testing")
+ p.set_option("opt", "testing")
+ self.assertEquals(p.get_option("opt"), "testing")
def test_set_nonexistant_plugin_option(self):
p = MockPlugin({})
- self.assertFalse(p.setOption("badopt", "testing"))
+ self.assertFalse(p.set_option("badopt", "testing"))
def test_get_nonexistant_plugin_option(self):
p = MockPlugin({})
- self.assertEquals(p.getOption("badopt"), 0)
+ self.assertEquals(p.get_option("badopt"), 0)
def test_get_unset_plugin_option(self):
p = MockPlugin({})
- self.assertEquals(p.getOption("opt"), 0)
+ self.assertEquals(p.get_option("opt"), 0)
def test_get_unset_plugin_option_with_default(self):
# this shows that even when we pass in a default to get,
# we'll get the option's default as set in the plugin
# this might not be what we really want
p = MockPlugin({})
- self.assertEquals(p.getOption("opt", True), True)
+ self.assertEquals(p.get_option("opt", True), True)
def test_get_unset_plugin_option_with_default_not_none(self):
# this shows that even when we pass in a default to get,
@@ -189,21 +189,21 @@ class PluginTests(unittest.TestCase):
# we'll get the option's default as set in the plugin
# this might not be what we really want
p = MockPlugin({})
- self.assertEquals(p.getOption("opt2", True), False)
+ self.assertEquals(p.get_option("opt2", True), False)
def test_get_option_as_list_plugin_option(self):
p = MockPlugin({})
- p.setOption("opt", "one,two,three")
- self.assertEquals(p.getOptionAsList("opt"), ['one', 'two', 'three'])
+ p.set_option("opt", "one,two,three")
+ self.assertEquals(p.get_option_as_list("opt"), ['one', 'two', 'three'])
def test_get_option_as_list_plugin_option_default(self):
p = MockPlugin({})
- self.assertEquals(p.getOptionAsList("opt", default=[]), [])
+ self.assertEquals(p.get_option_as_list("opt", default=[]), [])
def test_get_option_as_list_plugin_option_not_list(self):
p = MockPlugin({})
- p.setOption("opt", "testing")
- self.assertEquals(p.getOptionAsList("opt"), ['testing'])
+ p.set_option("opt", "testing")
+ self.assertEquals(p.get_option_as_list("opt"), ['testing'])
def test_copy_dir(self):
self.mp.doCopyFileOrDir("tests")
@@ -236,13 +236,13 @@ class AddCopySpecLimitTests(unittest.TestCase):
self.mp.archive = MockArchive()
def test_single_file_under_limit(self):
- self.mp.addCopySpecLimit("tests/tail_test.txt", 1)
- self.assertEquals(self.mp.copyPaths, [('tests/tail_test.txt', None)])
+ self.mp.add_copy_spec_limit("tests/tail_test.txt", 1)
+ self.assertEquals(self.mp.copy_paths, [('tests/tail_test.txt', None)])
def test_single_file_over_limit(self):
fn = create_file(2) # create 2MB file, consider a context manager
- self.mp.addCopySpecLimit(fn, 1, sub=('tmp', 'awesome'))
- content, fname = self.mp.copyStrings[0]
+ self.mp.add_copy_spec_limit(fn, 1, sub=('tmp', 'awesome'))
+ content, fname = self.mp.copy_strings[0]
self.assertTrue("tailed" in fname)
self.assertTrue("awesome" in fname)
self.assertTrue("/" not in fname)
@@ -250,16 +250,16 @@ class AddCopySpecLimitTests(unittest.TestCase):
os.unlink(fn)
def test_bad_filename(self):
- self.assertFalse(self.mp.addCopySpecLimit('', 1))
- self.assertFalse(self.mp.addCopySpecLimit(None, 1))
+ self.assertFalse(self.mp.add_copy_spec_limit('', 1))
+ self.assertFalse(self.mp.add_copy_spec_limit(None, 1))
def test_glob_file_over_limit(self):
# assume these are in /tmp
fn = create_file(2)
fn2 = create_file(2)
- self.mp.addCopySpecLimit("/tmp/tmp*", 1)
- self.assertEquals(len(self.mp.copyStrings), 1)
- content, fname = self.mp.copyStrings[0]
+ self.mp.add_copy_spec_limit("/tmp/tmp*", 1)
+ self.assertEquals(len(self.mp.copy_strings), 1)
+ content, fname = self.mp.copy_strings[0]
self.assertTrue("tailed" in fname)
self.assertEquals(1024 * 1024, len(content))
os.unlink(fn)
@@ -274,21 +274,21 @@ class CheckEnabledTests(unittest.TestCase):
def test_checks_for_file(self):
f = j("tail_test.txt")
self.mp.files = (f,)
- self.assertTrue(self.mp.checkenabled())
+ self.assertTrue(self.mp.check_enabled())
def test_checks_for_package(self):
self.mp.packages = ('foo',)
self.mp.is_installed = True
- self.assertTrue(self.mp.checkenabled())
+ self.assertTrue(self.mp.check_enabled())
def test_allows_bad_tuple(self):
f = j("tail_test.txt")
self.mp.files = (f)
self.mp.packages = ('foo')
- self.assertTrue(self.mp.checkenabled())
+ self.assertTrue(self.mp.check_enabled())
def test_enabled_by_default(self):
- self.assertTrue(self.mp.checkenabled())
+ self.assertTrue(self.mp.check_enabled())
class RegexSubTests(unittest.TestCase):
@@ -303,14 +303,14 @@ class RegexSubTests(unittest.TestCase):
self.assertEquals(0, self.mp.doFileSub("never_copied", r"^(.*)$", "foobar"))
def test_no_replacements(self):
- self.mp.addCopySpec(j("tail_test.txt"))
- self.mp.copyStuff()
+ self.mp.add_copy_spec(j("tail_test.txt"))
+ self.mp.collect()
replacements = self.mp.doFileSub(j("tail_test.txt"), r"wont_match", "foobar")
self.assertEquals(0, replacements)
def test_replacements(self):
- self.mp.addCopySpec(j("tail_test.txt"))
- self.mp.copyStuff()
+ self.mp.add_copy_spec(j("tail_test.txt"))
+ self.mp.collect()
replacements = self.mp.doFileSub(j("tail_test.txt"), r"(tail)", "foobar")
self.assertEquals(1, replacements)
self.assertTrue("foobar" in self.mp.archive.m.get(j('tail_test.txt')))
diff --git a/tests/policy_tests.py b/tests/policy_tests.py
index 25795a1c..aa74da7d 100644
--- a/tests/policy_tests.py
+++ b/tests/policy_tests.py
@@ -54,16 +54,16 @@ class PackageManagerTests(unittest.TestCase):
self.pm = PackageManager()
def test_default_all_pkgs(self):
- self.assertEquals(self.pm.allPkgs(), {})
+ self.assertEquals(self.pm.all_pkgs(), {})
def test_default_all_pkgs_by_name(self):
- self.assertEquals(self.pm.allPkgsByName('doesntmatter'), [])
+ self.assertEquals(self.pm.all_pkgs_by_name('doesntmatter'), [])
def test_default_all_pkgs_by_name_regex(self):
- self.assertEquals(self.pm.allPkgsByNameRegex('.*doesntmatter$'), [])
+ self.assertEquals(self.pm.all_pkgs_by_name_regex('.*doesntmatter$'), [])
def test_default_pkg_by_name(self):
- self.assertEquals(self.pm.pkgByName('foo'), None)
+ self.assertEquals(self.pm.pkg_by_name('foo'), None)
if __name__ == "__main__":
unittest.main()
diff --git a/tests/utilities_tests.py b/tests/utilities_tests.py
index 7b5a6a3b..5520bb16 100644
--- a/tests/utilities_tests.py
+++ b/tests/utilities_tests.py
@@ -2,7 +2,7 @@ import os.path
import unittest
from StringIO import StringIO
-from sos.utilities import grep, DirTree, checksum, get_hash_name, is_executable, sosGetCommandOutput, find, tail, shell_out
+from sos.utilities import grep, DirTree, checksum, get_hash_name, is_executable, sos_get_command_output, find, tail, shell_out
import sos
TEST_DIR = os.path.dirname(__file__)
@@ -76,13 +76,13 @@ class ExecutableTest(unittest.TestCase):
def test_output(self):
path = os.path.join(TEST_DIR, 'test_exe.py')
- ret, out, junk = sosGetCommandOutput(path)
+ ret, out, junk = sos_get_command_output(path)
self.assertEquals(ret, 0)
self.assertEquals(out, "executed\n")
def test_output_non_exe(self):
path = os.path.join(TEST_DIR, 'utility_tests.py')
- ret, out, junk = sosGetCommandOutput(path)
+ ret, out, junk = sos_get_command_output(path)
self.assertEquals(ret, 127)
self.assertEquals(out, "")