aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2013-03-28 18:08:59 +0000
committerBryn M. Reeves <bmr@redhat.com>2013-03-28 18:08:59 +0000
commit29e180fbc291686ee991952005c84c4b0d216a86 (patch)
tree1d6432854825efb97d816bc713145d052c8fce04
parent4f0da96964fec5bdc2b66d4117aa9773e5a12a4d (diff)
downloadsos-29e180fbc291686ee991952005c84c4b0d216a86.tar.gz
Make more names pep8 compliant across the tree
Fix policy and utility function, method and variable names to use lower case underscored style instead of camelCase. Related to Issue #112. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rwxr-xr-xexample_plugins/example.py2
-rw-r--r--sos/plugins/__init__.py126
-rw-r--r--sos/plugins/abrt.py2
-rw-r--r--sos/plugins/apache.py2
-rw-r--r--sos/plugins/as7.py2
-rw-r--r--sos/plugins/auditd.py2
-rw-r--r--sos/plugins/ceph.py2
-rw-r--r--sos/plugins/cloudforms.py4
-rw-r--r--sos/plugins/cluster.py8
-rw-r--r--sos/plugins/devicemapper.py10
-rw-r--r--sos/plugins/emc.py2
-rw-r--r--sos/plugins/filesys.py4
-rw-r--r--sos/plugins/general.py4
-rw-r--r--sos/plugins/gluster.py4
-rw-r--r--sos/plugins/hardware.py2
-rw-r--r--sos/plugins/infiniband.py2
-rw-r--r--sos/plugins/jboss.py2
-rw-r--r--sos/plugins/kernel.py8
-rw-r--r--sos/plugins/kvm.py2
-rw-r--r--sos/plugins/libraries.py2
-rw-r--r--sos/plugins/named.py16
-rw-r--r--sos/plugins/networking.py44
-rw-r--r--sos/plugins/nfsserver.py2
-rw-r--r--sos/plugins/nscd.py2
-rw-r--r--sos/plugins/openstack.py2
-rw-r--r--sos/plugins/postgresql.py2
-rw-r--r--sos/plugins/printing.py2
-rw-r--r--sos/plugins/psacct.py2
-rw-r--r--sos/plugins/pxe.py2
-rw-r--r--sos/plugins/rhevm.py2
-rw-r--r--sos/plugins/rhn.py4
-rw-r--r--sos/plugins/rhui.py4
-rw-r--r--sos/plugins/rpm.py2
-rw-r--r--sos/plugins/s390.py8
-rw-r--r--sos/plugins/sar.py6
-rw-r--r--sos/plugins/selinux.py6
-rw-r--r--sos/plugins/startup.py2
-rw-r--r--sos/plugins/sunrpc.py6
-rw-r--r--sos/plugins/veritas.py2
-rw-r--r--sos/plugins/xen.py12
-rw-r--r--sos/plugins/yum.py6
-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.py32
-rw-r--r--sos/utilities.py6
-rw-r--r--tests/option_tests.py4
-rw-r--r--tests/plugin_tests.py10
-rw-r--r--tests/policy_tests.py8
-rw-r--r--tests/utilities_tests.py6
51 files changed, 268 insertions, 268 deletions
diff --git a/example_plugins/example.py b/example_plugins/example.py
index 76977035..e13d92b5 100755
--- a/example_plugins/example.py
+++ b/example_plugins/example.py
@@ -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)]
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
index 1ce2fb0d..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
@@ -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,11 +158,11 @@ class Plugin(object):
return class_.__name__.lower()
def policy(self):
- return self.cInfo["policy"]
+ return self.commons["policy"]
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 do_cmd_output_sub(self, cmd, regexp, subst):
'''Apply a regexp substitution to command output archived by sosreport.
@@ -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,7 +197,7 @@ 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))
@@ -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,7 +230,7 @@ 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))
@@ -282,7 +282,7 @@ class Plugin(object):
%(linkdest, absdest))
self.do_copy_file_or_dir(absdest)
- self.copiedFiles.append({
+ self.copied_files.append({
'srcpath':srcpath,
'dstpath':srcpath,
'symlink':"yes",
@@ -293,7 +293,7 @@ class Plugin(object):
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
@@ -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:
@@ -363,20 +363,20 @@ class Plugin(object):
def add_forbidden_path(self, forbiddenPath):
- """Specify a path to not copy, even if it's part of a copyPaths[]
+ """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 get_all_options(self):
"""return a list of all options selected"""
- return (self.optNames, self.optParms)
+ return (self.opt_names, self.opt_parms)
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
@@ -402,13 +402,13 @@ 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
@@ -475,17 +475,17 @@ 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 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.
@@ -496,7 +496,7 @@ class Plugin(object):
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 file_grep(self, regexp, *fnames):
"""Returns lines matched in fnames, where fnames can either be
@@ -511,7 +511,7 @@ class Plugin(object):
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.mangle_command(exe))
+ outfn = os.path.join(self.commons['cmddir'], self.name(), self.mangle_command(exe))
# check for collisions
if os.path.exists(outfn):
@@ -527,17 +527,17 @@ class Plugin(object):
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 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
@@ -547,16 +547,16 @@ class Plugin(object):
else:
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))
@@ -573,14 +573,14 @@ class Plugin(object):
"""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 collect(self):
"""Collect the data for a plugin."""
- for path, sub in self.copyPaths:
+ 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,7 +588,7 @@ 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:
@@ -636,7 +636,7 @@ class Plugin(object):
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
diff --git a/sos/plugins/abrt.py b/sos/plugins/abrt.py
index 9a132463..ce5c7c10 100644
--- a/sos/plugins/abrt.py
+++ b/sos/plugins/abrt.py
@@ -21,7 +21,7 @@ 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 check_enabled(self):
return self.is_installed("abrt-cli") or \
diff --git a/sos/plugins/apache.py b/sos/plugins/apache.py
index a455b78e..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
diff --git a/sos/plugins/as7.py b/sos/plugins/as7.py
index 4f42e0cf..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),
diff --git a/sos/plugins/auditd.py b/sos/plugins/auditd.py
index 575d140d..41bd8605 100644
--- a/sos/plugins/auditd.py
+++ b/sos/plugins/auditd.py
@@ -18,7 +18,7 @@ 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.add_copy_specs(["/etc/audit/auditd.conf", "/etc/audit/audit.rules"])
diff --git a/sos/plugins/ceph.py b/sos/plugins/ceph.py
index f7619e91..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',
diff --git a/sos/plugins/cloudforms.py b/sos/plugins/cloudforms.py
index c76e6208..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")
+ 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")
+ 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 6479945a..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 check_enabled(self):
- rhelver = self.policy().rhelVersion()
+ rhelver = self.policy().rhel_version()
if rhelver == 4:
self.packages = [ "ccs", "cman", "cman-kernel", "magma",
"magma-plugins", "rgmanager", "fence", "dlm",
@@ -45,7 +45,7 @@ class cluster(Plugin, RedHatPlugin):
return Plugin.check_enabled(self)
def setup(self):
- rhelver = self.policy().rhelVersion()
+ rhelver = self.policy().rhel_version()
self.add_copy_spec("/etc/cluster.conf")
self.add_copy_spec("/etc/cluster.xml")
@@ -106,7 +106,7 @@ class cluster(Plugin, RedHatPlugin):
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.call_ext_prog("cman_tool services")
diff --git a/sos/plugins/devicemapper.py b/sos/plugins/devicemapper.py
index 67c50b8a..aac90193 100644
--- a/sos/plugins/devicemapper.py
+++ b/sos/plugins/devicemapper.py
@@ -19,14 +19,14 @@ 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")
+ cmd = "lvmdump -d '%s'" % os.path.join(self.commons['dstroot'],"lvmdump")
if self.get_option('lvmdump-a'):
cmd += " -a"
self.add_cmd_output(cmd)
@@ -65,5 +65,5 @@ class devicemapper(Plugin, RedHatPlugin):
if disk in [ ".", ".." ] or disk.startswith("ram"):
continue
self.add_cmd_output("/usr/bin/udevinfo -ap /sys/block/%s" % (disk))
- for opt in self.dmraidOptions:
+ for opt in self.dmraid_options:
self.add_cmd_output("/sbin/dmraid -%s" % (opt,))
diff --git a/sos/plugins/emc.py b/sos/plugins/emc.py
index 7b711457..c386e70e 100644
--- a/sos/plugins/emc.py
+++ b/sos/plugins/emc.py
@@ -168,7 +168,7 @@ 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.add_custom_text("EMC Solutions Enabler is installed.<br>")
diff --git a/sos/plugins/filesys.py b/sos/plugins/filesys.py
index 49c4b3b9..5409320f 100644
--- a/sos/plugins/filesys.py
+++ b/sos/plugins/filesys.py
@@ -20,8 +20,8 @@ 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.add_copy_specs([
diff --git a/sos/plugins/general.py b/sos/plugins/general.py
index d5ceac46..d94c0c54 100644
--- a/sos/plugins/general.py
+++ b/sos/plugins/general.py
@@ -20,7 +20,7 @@ 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):
@@ -74,7 +74,7 @@ class RedHatGeneral(general, RedHatPlugin):
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.do_regex_find_all("^\S+\s+(-?\/.*$)\s+", "/etc/rsyslog.conf")
print logs
diff --git a/sos/plugins/gluster.py b/sos/plugins/gluster.py
index e579c023..6383938b 100644
--- a/sos/plugins/gluster.py
+++ b/sos/plugins/gluster.py
@@ -79,9 +79,9 @@ class gluster(Plugin, RedHatPlugin):
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
diff --git a/sos/plugins/hardware.py b/sos/plugins/hardware.py
index df7cf672..ef6359ff 100644
--- a/sos/plugins/hardware.py
+++ b/sos/plugins/hardware.py
@@ -55,7 +55,7 @@ class hardware(Plugin):
self.add_cmd_output("/usr/bin/cpupower info")
self.add_cmd_output("/usr/bin/cpupower frequency-info")
- if self.policy().getArch().endswith("386"):
+ if self.policy().get_arch().endswith("386"):
self.add_cmd_output("/usr/sbin/x86info -a")
if os.path.exists("/usr/bin/lsusb"):
diff --git a/sos/plugins/infiniband.py b/sos/plugins/infiniband.py
index 735330bb..59cc5078 100644
--- a/sos/plugins/infiniband.py
+++ b/sos/plugins/infiniband.py
@@ -21,7 +21,7 @@ class infiniband(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""
def check_enabled(self):
- if self.cInfo["policy"].pkgByName("libibverbs-utils"):
+ if self.commons["policy"].pkg_by_name("libibverbs-utils"):
return True
return False
diff --git a/sos/plugins/jboss.py b/sos/plugins/jboss.py
index 1f4912e0..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),
diff --git a/sos/plugins/kernel.py b/sos/plugins/kernel.py
index 96dc10fd..2922d123 100644
--- a/sos/plugins/kernel.py
+++ b/sos/plugins/kernel.py
@@ -18,12 +18,12 @@ 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.add_cmd_output("/bin/uname -a", root_symlink = "uname")
- self.moduleFile = self.get_cmd_output_now("/sbin/lsmod", root_symlink = "lsmod")
+ self.module_file = self.get_cmd_output_now("/sbin/lsmod", root_symlink = "lsmod")
if self.get_option('modinfo'):
runcmd = ""
@@ -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",
diff --git a/sos/plugins/kvm.py b/sos/plugins/kvm.py
index 7eed6dcf..dbc94033 100644
--- a/sos/plugins/kvm.py
+++ b/sos/plugins/kvm.py
@@ -22,7 +22,7 @@ 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 check_enabled(self):
return os.access("/sys/module/kvm", os.R_OK)
diff --git a/sos/plugins/libraries.py b/sos/plugins/libraries.py
index adb83644..32db9c82 100644
--- a/sos/plugins/libraries.py
+++ b/sos/plugins/libraries.py
@@ -18,7 +18,7 @@ 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):
diff --git a/sos/plugins/named.py b/sos/plugins/named.py
index b32c71cd..812e20da 100644
--- a/sos/plugins/named.py
+++ b/sos/plugins/named.py
@@ -23,21 +23,21 @@ 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.do_regex_find_all("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.add_copy_spec(cfg)
- self.add_copy_spec(self.getDnsDir(cfg))
- self.add_forbidden_path(join(self.getDnsDir(cfg),"chroot/dev"))
- self.add_forbidden_path(join(self.getDnsDir(cfg),"chroot/proc"))
+ 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")
diff --git a/sos/plugins/networking.py b/sos/plugins/networking.py
index 0097368e..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
@@ -70,12 +70,12 @@ class networking(Plugin, RedHatPlugin):
"/etc/xinetd.d",
"/etc/host*",
"/etc/resolv.conf"])
- ipaddrFile=self.get_cmd_output_now("/sbin/ip -o addr", root_symlink = "ip_addr")
- ipaddrOut=self.call_ext_prog("/sbin/ip -o addr")
+ 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.collectIPTable("filter")
- self.collectIPTable("nat")
- self.collectIPTable("mangle")
+ 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")
@@ -87,8 +87,8 @@ class networking(Plugin, RedHatPlugin):
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 ipaddrOut:
- for eth in self.get_interface_name(ipaddrOut):
+ 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)
@@ -100,10 +100,10 @@ class networking(Plugin, RedHatPlugin):
self.add_cmd_output("/bin/traceroute -n rhn.redhat.com")
if os.path.exists("/usr/sbin/brctl"):
- brctlFile=self.add_cmd_output("/usr/sbin/brctl show")
- brctlOut=self.call_ext_prog("/usr/sbin/brctl show")
- if brctlOut:
- for brName in self.get_bridge_name(brctlOut):
- self.add_cmd_output("/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 2c466a4a..1229dcf1 100644
--- a/sos/plugins/nfsserver.py
+++ b/sos/plugins/nfsserver.py
@@ -22,7 +22,7 @@ class nfsserver(Plugin, RedHatPlugin):
"""NFS server-related information
"""
def check_enabled(self):
- if self.policy().runlevelDefault() in self.policy().runlevelByService("nfs"):
+ if self.policy().default_runlevel() in self.policy().runlevel_by_service("nfs"):
return True
try:
diff --git a/sos/plugins/nscd.py b/sos/plugins/nscd.py
index c988aa14..8139fac9 100644
--- a/sos/plugins/nscd.py
+++ b/sos/plugins/nscd.py
@@ -20,7 +20,7 @@ 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',)
diff --git a/sos/plugins/openstack.py b/sos/plugins/openstack.py
index 59760076..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):
diff --git a/sos/plugins/postgresql.py b/sos/plugins/postgresql.py
index 1ae3e6e9..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', '', ''),
diff --git a/sos/plugins/printing.py b/sos/plugins/printing.py
index a170cccf..fc85af22 100644
--- a/sos/plugins/printing.py
+++ b/sos/plugins/printing.py
@@ -17,7 +17,7 @@ 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):
diff --git a/sos/plugins/psacct.py b/sos/plugins/psacct.py
index 192901ad..528f141c 100644
--- a/sos/plugins/psacct.py
+++ b/sos/plugins/psacct.py
@@ -18,7 +18,7 @@ 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" ]
diff --git a/sos/plugins/pxe.py b/sos/plugins/pxe.py
index 1bcea320..4cdd2f76 100644
--- a/sos/plugins/pxe.py
+++ b/sos/plugins/pxe.py
@@ -19,7 +19,7 @@ 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',)
diff --git a/sos/plugins/rhevm.py b/sos/plugins/rhevm.py
index fd5955f5..a9cd5f2d 100644
--- a/sos/plugins/rhevm.py
+++ b/sos/plugins/rhevm.py
@@ -4,7 +4,7 @@ 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.
diff --git a/sos/plugins/rhn.py b/sos/plugins/rhn.py
index 52f9a75a..0686c8bd 100644
--- a/sos/plugins/rhn.py
+++ b/sos/plugins/rhn.py
@@ -21,7 +21,7 @@ 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 default_enabled(self):
return False
@@ -76,7 +76,7 @@ class rhn(Plugin, RedHatPlugin):
"/etc/tomcat6/", "/var/log/tomcat6/"])
if os.path.exists("/usr/bin/spacewalk-debug"):
self.add_cmd_output("/usr/bin/spacewalk-debug --dir %s"
- % os.path.join(self.cInfo['dstroot'],
+ % os.path.join(self.commons['dstroot'],
"sos_commands/rhn"))
if self.proxy:
diff --git a/sos/plugins/rhui.py b/sos/plugins/rhui.py
index 99a12993..78874098 100644
--- a/sos/plugins/rhui.py
+++ b/sos/plugins/rhui.py
@@ -30,8 +30,8 @@ class rhui(Plugin, RedHatPlugin):
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:
diff --git a/sos/plugins/rpm.py b/sos/plugins/rpm.py
index 38605124..3acf7ec1 100644
--- a/sos/plugins/rpm.py
+++ b/sos/plugins/rpm.py
@@ -17,7 +17,7 @@ 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):
diff --git a/sos/plugins/s390.py b/sos/plugins/s390.py
index 73f6158c..5b5e8274 100644
--- a/sos/plugins/s390.py
+++ b/sos/plugins/s390.py
@@ -24,7 +24,7 @@ class s390(Plugin, RedHatPlugin):
### Check for s390 arch goes here
def check_enabled(self):
- return (self.policy().getArch() == "s390")
+ return (self.policy().get_arch() == "s390")
### Gather s390 specific information
@@ -57,12 +57,12 @@ class s390(Plugin, RedHatPlugin):
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, dasdDev, rtime = self.call_ext_prog("/bin/ls /dev/dasd?")
- for x in dasdDev.split('\n'):
+ 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.add_cmd_output("/sbin/lsqeth")
self.add_cmd_output("/sbin/lszfcp")
diff --git a/sos/plugins/sar.py b/sos/plugins/sar.py
index 9b495dda..5a00372e 100644
--- a/sos/plugins/sar.py
+++ b/sos/plugins/sar.py
@@ -40,17 +40,17 @@ 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.add_cmd_output(sar_command, sar_filename)
diff --git a/sos/plugins/selinux.py b/sos/plugins/selinux.py
index d2c5da36..0d3c6d3a 100644
--- a/sos/plugins/selinux.py
+++ b/sos/plugins/selinux.py
@@ -17,7 +17,7 @@ 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 check_enabled()
self.add_copy_spec("/etc/selinux")
@@ -26,11 +26,11 @@ class selinux(Plugin, RedHatPlugin):
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=do_regex_find_all(r"^.*setroubleshoot:.*(sealert\s-l\s.*)","/var/log/messages")
if sealert:
diff --git a/sos/plugins/startup.py b/sos/plugins/startup.py
index c20e9873..70f8966a 100644
--- a/sos/plugins/startup.py
+++ b/sos/plugins/startup.py
@@ -18,7 +18,7 @@ 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.add_copy_spec("/etc/rc.d")
diff --git a/sos/plugins/sunrpc.py b/sos/plugins/sunrpc.py
index e76d8461..a59fa678 100644
--- a/sos/plugins/sunrpc.py
+++ b/sos/plugins/sunrpc.py
@@ -24,8 +24,8 @@ class sunrpc(Plugin):
service = None
def check_enabled(self):
- if self.policy().runlevelDefault() in \
- self.policy().runlevelByService(self.service):
+ if self.policy().default_runlevel() in \
+ self.policy().runlevel_by_service(self.service):
return True
return False
@@ -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
diff --git a/sos/plugins/veritas.py b/sos/plugins/veritas.py
index 0322035c..03eda211 100644
--- a/sos/plugins/veritas.py
+++ b/sos/plugins/veritas.py
@@ -20,7 +20,7 @@ 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 check_enabled(self):
return os.path.isfile(self.get_option("script"))
diff --git a/sos/plugins/xen.py b/sos/plugins/xen.py
index 424e2f1c..a8b1110e 100644
--- a/sos/plugins/xen.py
+++ b/sos/plugins/xen.py
@@ -20,7 +20,7 @@ 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.call_ext_prog("grep -qi xen /proc/acpi/dsdt")
if status == 0:
@@ -35,14 +35,14 @@ class xen(Plugin, RedHatPlugin):
return "baremetal"
def check_enabled(self):
- return (self.determineXenHost() == "baremetal")
+ 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):
+ def dom_collect_proc(self):
self.add_copy_specs([
"/proc/xen/balloon",
"/proc/xen/capabilities",
@@ -54,10 +54,10 @@ class xen(Plugin, RedHatPlugin):
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.add_copy_spec("/sys/hypervisor")
@@ -78,7 +78,7 @@ class xen(Plugin, RedHatPlugin):
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.domCollectProc()
+ self.dom_collect_proc()
if self.is_running_xenstored():
self.add_copy_spec("/sys/hypervisor/uuid")
self.add_cmd_output("/usr/bin/xenstore-ls")
diff --git a/sos/plugins/yum.py b/sos/plugins/yum.py
index 9536a958..17684f21 100644
--- a/sos/plugins/yum.py
+++ b/sos/plugins/yum.py
@@ -21,11 +21,11 @@ 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.add_copy_specs([
@@ -56,7 +56,7 @@ class yum(Plugin, RedHatPlugin):
if self.get_option("yumdebug") and self.is_installed('yum-utils'):
# RHEL6+ alternative for this whole function:
- # self.add_cmd_output("/usr/bin/yum-debug-dump '%s'" % os.path.join(self.cInfo['dstroot'],"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.add_cmd_output("/bin/zcat %s" % (output.split()[-1],))
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 eb4f89ee..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)
@@ -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
@@ -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
@@ -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()
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 6114c9b2..d221b965 100644
--- a/tests/option_tests.py
+++ b/tests/option_tests.py
@@ -15,8 +15,8 @@ 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.get_option('test_option'), 'foobar')
diff --git a/tests/plugin_tests.py b/tests/plugin_tests.py
index 153ff350..09d4c2ac 100644
--- a/tests/plugin_tests.py
+++ b/tests/plugin_tests.py
@@ -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):
@@ -237,12 +237,12 @@ class AddCopySpecLimitTests(unittest.TestCase):
def test_single_file_under_limit(self):
self.mp.add_copy_spec_limit("tests/tail_test.txt", 1)
- self.assertEquals(self.mp.copyPaths, [('tests/tail_test.txt', None)])
+ 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.add_copy_spec_limit(fn, 1, sub=('tmp', 'awesome'))
- content, fname = self.mp.copyStrings[0]
+ content, fname = self.mp.copy_strings[0]
self.assertTrue("tailed" in fname)
self.assertTrue("awesome" in fname)
self.assertTrue("/" not in fname)
@@ -258,8 +258,8 @@ class AddCopySpecLimitTests(unittest.TestCase):
fn = create_file(2)
fn2 = create_file(2)
self.mp.add_copy_spec_limit("/tmp/tmp*", 1)
- self.assertEquals(len(self.mp.copyStrings), 1)
- content, fname = self.mp.copyStrings[0]
+ 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)
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, "")