diff options
114 files changed, 896 insertions, 896 deletions
diff --git a/example_plugins/example.py b/example_plugins/example.py index 4b49e423..76977035 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 @@ -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..875821c8 100644 --- a/sos/plugins/__init__.py +++ b/sos/plugins/__init__.py @@ -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. """ @@ -160,11 +160,11 @@ class Plugin(object): def policy(self): return self.cInfo["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) - 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 @@ -203,7 +203,7 @@ class Plugin(object): % (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 @@ -236,7 +236,7 @@ class Plugin(object): % (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,10 +277,10 @@ 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({ 'srcpath':srcpath, @@ -290,7 +290,7 @@ 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: @@ -299,7 +299,7 @@ class Plugin(object): 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 @@ -362,7 +362,7 @@ class Plugin(object): self.soslog.error(traceback.format_exc()) - def addForbiddenPath(self, forbiddenPath): + def add_forbidden_path(self, forbiddenPath): """Specify a path to not copy, even if it's part of a copyPaths[] entry. """ @@ -370,11 +370,11 @@ class Plugin(object): for filespec in glob.glob(forbiddenPath): self.forbiddenPaths.append(filespec) - def getAllOptions(self): + def get_all_options(self): """return a list of all options selected""" return (self.optNames, self.optParms) - 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): if name == optionname: @@ -383,11 +383,11 @@ class Plugin(object): 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. @@ -414,18 +414,18 @@ class Plugin(object): 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. """ @@ -478,7 +478,7 @@ class Plugin(object): if filespec not in self.copyPaths: self.copyPaths.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. """ @@ -490,28 +490,28 @@ class Plugin(object): 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) ) - 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.cInfo['cmddir'], self.name(), self.mangle_command(exe)) # check for collisions if os.path.exists(outfn): @@ -525,11 +525,11 @@ 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)) - 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. """ @@ -543,9 +543,9 @@ class Plugin(object): 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:] self.archive.add_string(shout, outfn) @@ -563,22 +563,22 @@ class Plugin(object): 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 - def copyStuff(self): + def copy_stuff(self): """Collect the data for a plugin.""" for path, sub in self.copyPaths: - self.doCopyFileOrDir(path, sub=sub) + self.do_copy_file_or_dir(path, sub=sub) for string, file_name in self.copyStrings: try: @@ -592,7 +592,7 @@ class Plugin(object): 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,10 +627,10 @@ 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 @@ -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..9a132463 100644 --- a/sos/plugins/abrt.py +++ b/sos/plugins/abrt.py @@ -23,21 +23,21 @@ class abrt(Plugin, RedHatPlugin): optionList = [("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..a455b78e 100644 --- a/sos/plugins/apache.py +++ b/sos/plugins/apache.py @@ -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..4f42e0cf 100644 --- a/sos/plugins/as7.py +++ b/sos/plugins/as7.py @@ -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..575d140d 100644 --- a/sos/plugins/auditd.py +++ b/sos/plugins/auditd.py @@ -21,5 +21,5 @@ class auditd(Plugin, RedHatPlugin): optionList = [("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..f7619e91 100644 --- a/sos/plugins/ceph.py +++ b/sos/plugins/ceph.py @@ -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..c76e6208 100644 --- a/sos/plugins/cloudforms.py +++ b/sos/plugins/cloudforms.py @@ -30,8 +30,8 @@ class cloudforms(Plugin, RedHatPlugin): 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)) + 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)) + 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..6479945a 100644 --- a/sos/plugins/cluster.py +++ b/sos/plugins/cluster.py @@ -24,7 +24,7 @@ class cluster(Plugin, RedHatPlugin): 'gather output of gfs lockdumps', 'slow', False), ('lockdump', 'gather dlm lockdumps', 'slow', False)] - def checkenabled(self): + def check_enabled(self): rhelver = self.policy().rhelVersion() if rhelver == 4: self.packages = [ "ccs", "cman", "cman-kernel", "magma", @@ -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'): + 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() 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..67c50b8a 100644 --- a/sos/plugins/devicemapper.py +++ b/sos/plugins/devicemapper.py @@ -27,43 +27,43 @@ class devicemapper(Plugin, RedHatPlugin): """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'): + 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)) + self.add_cmd_output("/usr/bin/udevinfo -ap /sys/block/%s" % (disk)) for opt in self.dmraidOptions: - self.addCmdOutput("/sbin/dmraid -%s" % (opt,)) + 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..7b711457 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²</font><font size="-2" color="blue">®</font>') - self.addCustomText('<br><font size="+1">where information lives</font><font size="-2">®</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. ") - 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²</font><font size="-2" color="blue">®</font>') + self.add_custom_text('<br><font size="+1">where information lives</font><font size="-2">®</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. ") + 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" @@ -171,7 +171,7 @@ class emc(Plugin, RedHatPlugin): if len(self.policy().package_manager.allPkgsByNameRegex('[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..49c4b3b9 100644 --- a/sos/plugins/filesys.py +++ b/sos/plugins/filesys.py @@ -24,7 +24,7 @@ class filesys(Plugin, RedHatPlugin, UbuntuPlugin): optionList = [("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 62c7e441..d5ceac46 100644 --- a/sos/plugins/general.py +++ b/sos/plugins/general.py @@ -24,7 +24,7 @@ class general(Plugin): ("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") \ 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, UbuntuPlugin): def setup(self): super(GeneralDebian, 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(GeneralUbuntu, 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..e579c023 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,7 +76,7 @@ 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"); @@ -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..df7cf672 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") + 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..735330bb 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): + def check_enabled(self): if self.cInfo["policy"].pkgByName("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..1f4912e0 100644 --- a/sos/plugins/jboss.py +++ b/sos/plugins/jboss.py @@ -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 931eb436..9996b730 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..96dc10fd 100644 --- a/sos/plugins/kernel.py +++ b/sos/plugins/kernel.py @@ -22,22 +22,22 @@ class kernel(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): moduleFile = "" 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.moduleFile = 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", @@ -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..7eed6dcf 100644 --- a/sos/plugins/kvm.py +++ b/sos/plugins/kvm.py @@ -24,7 +24,7 @@ class kvm(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): optionList = [("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..adb83644 100644 --- a/sos/plugins/libraries.py +++ b/sos/plugins/libraries.py @@ -22,7 +22,7 @@ class libraries(Plugin, RedHatPlugin, UbuntuPlugin): "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..b32c71cd 100644 --- a/sos/plugins/named.py +++ b/sos/plugins/named.py @@ -26,7 +26,7 @@ class named(Plugin, RedHatPlugin): def getDnsDir(self, configFile): """ grab directory path from named{conf,boot} """ - directoryList = self.doRegexFindAll("directory\s+\"(.*)\"", configFile) + directoryList = self.do_regex_find_all("directory\s+\"(.*)\"", configFile) return normpath(directoryList[0]) def setup(self): @@ -34,18 +34,18 @@ class named(Plugin, RedHatPlugin): "/etc/named.boot") for cfg in cfgFiles: 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.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("/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..0097368e 100644 --- a/sos/plugins/networking.py +++ b/sos/plugins/networking.py @@ -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") + ipaddrFile=self.get_cmd_output_now("/sbin/ip -o addr", root_symlink = "ip_addr") + ipaddrOut=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.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") + 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 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") + 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") + 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.addCmdOutput("/usr/sbin/brctl showstp "+brName) + self.add_cmd_output("/usr/sbin/brctl showstp "+brName) return diff --git a/sos/plugins/nfsserver.py b/sos/plugins/nfsserver.py index b1acbcf7..2c466a4a 100644 --- a/sos/plugins/nfsserver.py +++ b/sos/plugins/nfsserver.py @@ -21,7 +21,7 @@ from stat import ST_SIZE class nfsserver(Plugin, RedHatPlugin): """NFS server-related information """ - def checkenabled(self): + def check_enabled(self): if self.policy().runlevelDefault() in self.policy().runlevelByService("nfs"): return True @@ -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..c988aa14 100644 --- a/sos/plugins/nscd.py +++ b/sos/plugins/nscd.py @@ -27,11 +27,11 @@ class nscd(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): 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..59760076 100644 --- a/sos/plugins/openstack.py +++ b/sos/plugins/openstack.py @@ -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..1ae3e6e9 100644 --- a/sos/plugins/postgresql.py +++ b/sos/plugins/postgresql.py @@ -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..a170cccf 100644 --- a/sos/plugins/printing.py +++ b/sos/plugins/printing.py @@ -21,11 +21,11 @@ class printing(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): "", 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..192901ad 100644 --- a/sos/plugins/psacct.py +++ b/sos/plugins/psacct.py @@ -24,6 +24,6 @@ class psacct(Plugin, RedHatPlugin): 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..1bcea320 100644 --- a/sos/plugins/pxe.py +++ b/sos/plugins/pxe.py @@ -24,7 +24,7 @@ class pxe(Plugin, RedHatPlugin): 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..fd5955f5 100644 --- a/sos/plugins/rhevm.py +++ b/sos/plugins/rhevm.py @@ -8,16 +8,16 @@ class rhevm(Plugin, RedHatPlugin): 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..52f9a75a 100644 --- a/sos/plugins/rhn.py +++ b/sos/plugins/rhn.py @@ -23,40 +23,40 @@ class rhn(Plugin, RedHatPlugin): optionList = [("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" + self.add_cmd_output("/usr/bin/spacewalk-debug --dir %s" % os.path.join(self.cInfo['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..99a12993 100644 --- a/sos/plugins/rhui.py +++ b/sos/plugins/rhui.py @@ -25,7 +25,7 @@ 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 = "" @@ -37,7 +37,7 @@ class rhui(Plugin, RedHatPlugin): 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..38605124 100644 --- a/sos/plugins/rpm.py +++ b/sos/plugins/rpm.py @@ -21,15 +21,15 @@ class rpm(Plugin, RedHatPlugin): ("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..73f6158c 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): + def check_enabled(self): return (self.policy().getArch() == "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?") + 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, dasdDev, rtime = self.call_ext_prog("/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/dasdview -x -i -j -l -f %s" % (x,)) + self.add_cmd_output("/sbin/fdasd -p %s" % (x,)) try: rhelver = self.policy().rhelVersion() 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..9b495dda 100644 --- a/sos/plugins/sar.py +++ b/sos/plugins/sar.py @@ -53,5 +53,5 @@ class sar(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): if sar_filename not in dirList: 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..d2c5da36 100644 --- a/sos/plugins/selinux.py +++ b/sos/plugins/selinux.py @@ -19,12 +19,12 @@ class selinux(Plugin, RedHatPlugin): """ optionList = [("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'): return @@ -32,15 +32,15 @@ class selinux(Plugin, RedHatPlugin): # Check for SELinux denials and capture raw output from sealert if self.policy().runlevelDefault() in self.policy().runlevelByService("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..c20e9873 100644 --- a/sos/plugins/startup.py +++ b/sos/plugins/startup.py @@ -20,9 +20,9 @@ class startup(Plugin, RedHatPlugin): optionList = [("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..e76d8461 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): + def check_enabled(self): if self.policy().runlevelDefault() in \ self.policy().runlevelByService(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): @@ -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..0322035c 100644 --- a/sos/plugins/veritas.py +++ b/sos/plugins/veritas.py @@ -22,17 +22,17 @@ class veritas(Plugin, RedHatPlugin): # http://seer.entsupport.symantec.com/docs/243150.htm optionList = [("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..424e2f1c 100644 --- a/sos/plugins/xen.py +++ b/sos/plugins/xen.py @@ -22,19 +22,19 @@ class xen(Plugin, RedHatPlugin): """ def determineXenHost(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): + def check_enabled(self): return (self.determineXenHost() == "baremetal") def is_running_xenstored(self): @@ -43,15 +43,15 @@ class xen(Plugin, RedHatPlugin): return xs_pidnum.isdigit() def domCollectProc(self): - self.addCopySpecs([ + 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() @@ -60,31 +60,31 @@ class xen(Plugin, RedHatPlugin): self.domCollectProc() # 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.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.domCollectProc() 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..9536a958 100644 --- a/sos/plugins/yum.py +++ b/sos/plugins/yum.py @@ -28,37 +28,37 @@ class yum(Plugin, RedHatPlugin): rhelver = self.policy().rhelVersion() # 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.cInfo['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/sosreport.py b/sos/sosreport.py index b5691c05..213eee72 100644 --- a/sos/sosreport.py +++ b/sos/sosreport.py @@ -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) @@ -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)) @@ -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.copy_stuff() except KeyboardInterrupt: raise except: diff --git a/tests/option_tests.py b/tests/option_tests.py index 03804dec..6114c9b2 100644 --- a/tests/option_tests.py +++ b/tests/option_tests.py @@ -19,16 +19,16 @@ class GlobalOptionTest(unittest.TestCase): self.plugin.optParms = [{'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..0e7869bb 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__) @@ -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,12 +236,12 @@ class AddCopySpecLimitTests(unittest.TestCase): self.mp.archive = MockArchive() def test_single_file_under_limit(self): - self.mp.addCopySpecLimit("tests/tail_test.txt", 1) + self.mp.add_copy_spec_limit("tests/tail_test.txt", 1) self.assertEquals(self.mp.copyPaths, [('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')) + self.mp.add_copy_spec_limit(fn, 1, sub=('tmp', 'awesome')) content, fname = self.mp.copyStrings[0] self.assertTrue("tailed" in fname) self.assertTrue("awesome" in fname) @@ -250,14 +250,14 @@ 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.mp.add_copy_spec_limit("/tmp/tmp*", 1) self.assertEquals(len(self.mp.copyStrings), 1) content, fname = self.mp.copyStrings[0] self.assertTrue("tailed" in fname) @@ -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.copy_stuff() 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.copy_stuff() 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'))) |