aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Elide bootloader password in grub pluginBryn M. Reeves2014-06-021-0/+7
| | | | | | | | | The grub.conf configuration file collected by the grub plugin may contain a plaintext or md5 hashed bootloader password. Add a regex substitution for all files matching '.*\/grub\.conf' and replace the password with '*'s. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Make do_path_regex_sub() honour string regex argumentsBryn M. Reeves2014-06-021-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Plugin.do_path_regex_sub() method to apply regex substitutions to paths matching a pattern documents that it accepts either a compiled re object or a regular expression as a string: '''Apply a regexp substituation to a set of files archived by sos. The set of files to be substituted is generated by matching collected file pathnames against pathexp which may be a regular expression string or compiled re object. The portion of the file to be replaced is specified via regexp and the replacement string is passed in subst.''' It lies. Attempting to pass a string for the 'pathexp' parameter will result in: Traceback (most recent call last): File "/usr/sbin/sosreport", line 23, in <module> main(sys.argv[1:]) File "/usr/lib/python2.6/site-packages/sos/sosreport.py", line 1229, in main sos.execute() AttributeError: 'str' object has no attribute 'match' > /usr/lib/python2.6/site-packages/sos/plugins/__init__.py(219)do_path_regex_sub() -> match = pathexp.match Look to see if the object we are passed has a 'match()' method and call re.compile on it if it does not. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Fix call_ext_prog() use in abrt, s390, veritas, xen and yumBryn M. Reeves2014-06-025-11/+12
| | | | | | | | Several plugins still tried to use the old tuple based return values for self.call_ext_prog(). Convert them to use the dictionary values instead. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Add postprocessing for /etc/fstab passwordsBryn M. Reeves2014-05-301-0/+7
| | | | Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* travis-ci supports python 3.4Adam Stokes2014-05-291-3/+0
| | | | | | | now that travis-ci supports python 3.4 we make the unittests pass on that version a requirement. Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
* Set global{locking_type=0} when running lvm2 commandsBryn M. Reeves2014-05-281-6/+17
| | | | | | | | The lvm2 commands that sos issues are all read-only. Disable locking when running the commands to avoid blocking if another process or node is holding a lock. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Fix call_ext_prog() use in oVirt pluginBryn M. Reeves2014-05-211-1/+1
| | | | | | | | The oVirt plugin tried to use the old tuple based return values for self.call_ext_prog(). Convert it to use the dictionary values instead. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Add oVirt pluginBryn M. Reeves2014-05-191-0/+136
| | | | | | | Add a plugin for oVirt based on the RHEV log collector plugin with improvements and suggestions from Sandro Bonazzola. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Add tuned configuration paths to tuned pluginBryn M. Reeves2014-05-071-1/+5
| | | | Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Don't use a glob to collect /var/log/boot.logBryn M. Reeves2014-04-291-1/+1
| | | | | | | | | Using a glob to pick up the boot logs means that we can pull in unexpected content, e.g. /var/log/bootchart which may be large. Just pick up the log file we're interested in. Fixes Issue #150. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Drop Windows supportBryn M. Reeves2014-04-291-48/+0
| | | | | | | | The Windows port is unmaintained (and likely broken). Drop the support for now. If there's interest in developing and maintaining the port in the future this can be easily reverted. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* sosreport: Add support for new ppc64-diag elog formatSamuel Mendoza-Jonas2014-04-291-3/+4
| | | | | | | | | Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Samuel Mendoza-Jonas <samjc.mj@gmail.com> Minor fixups for missing comas and to apply to the current tree. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Make calls to TarFile.add() use absolute path for 'name'Bryn M. Reeves2014-04-291-2/+3
| | | | | | | | Always use an absolute path when calling TarFile.add() in TarFileArchive._build_archive() and set arcname explicitly to the (relative) path name to use in the archive. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Drop cwd/umask shenanigans from TarFileArchive::finalize()Bryn M. Reeves2014-04-291-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | It was necessary to save and restore old_cwd and the umask around calls to an external archive program. This isn't needed when using native python implementations and causes problems in the case that the current working directory no longer exists: Creating compressed archive... going to finalize did finalize exception: [Errno 2] No such file or directory shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory Traceback (most recent call last): File "/sbin/sosreport", line 23, in <module> main(sys.argv[1:]) File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 1233, in main sos.execute() File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 1222, in execute return self.final_work() File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 1159, in final_work raise e OSError: [Errno 2] No such file or directory Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Fix exception in Policy::get_pkg_list()Bryn M. Reeves2014-04-291-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the current working directory (as reported by getcwd()) does not exist the package manager component of the policy may fail to initialise: shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory Traceback (most recent call last): File "/sbin/sosreport", line 23, in <module> main(sys.argv[1:]) File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 1228, in main sos = SoSReport(args) File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 530, in __init__ self.policy = sos.policies.load() File "/usr/lib/python2.7/site-packages/sos/policies/__init__.py", line 39, in load cache['policy'] = policy() File "/usr/lib/python2.7/site-packages/sos/policies/redhat.py", line 165, in __init__ super(FedoraPolicy, self).__init__() File "/usr/lib/python2.7/site-packages/sos/policies/redhat.py", line 49, in __init__ if self.package_manager.all_pkgs()['filesystem']['version'][0] == '3': File "/usr/lib/python2.7/site-packages/sos/policies/__init__.py", line 108, in all_pkgs self.packages = self.get_pkg_list() File "/usr/lib/python2.7/site-packages/sos/policies/__init__.py", line 95, in get_pkg_list name, version = pkg.split("|") ValueError: need more than 1 value to unpack Fix this by ensuring that the string contains at least one pipe character before splitting. There are many reasons that the package manager could spit out unexpected lines with the package list so this improves the general robustness of this code. Fixes RHBZ#1091683. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Fix logging exception in Plugin.collect_strings()Bryn M. Reeves2014-04-241-1/+1
| | | | Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Fix libvirt password regexBryn M. Reeves2014-04-241-1/+1
| | | | | | | The anchor at the end of the qemu XML password regex causes it to not match in some cases. Remove it as it is unneccessary anyway. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>`
* Add rabbitmq-server plugin to collect config and logsLouis Bouchard2014-04-241-0/+33
| | | | Signed-off-by: Louis Bouchard <louis.bouchard@canonical.com>
* Add upstart log collectionLouis Bouchard2014-04-231-0/+6
| | | | Signed-off-by: Louis Bouchard <louis.bouchard@canonical.com>
* Fix pep8 complaintsLouis Bouchard2014-04-231-0/+1
| | | | Signed-off-by: Louis Bouchard <louis.bouchard@canonical.com>
* Add squid3 log collectionLouis Bouchard2014-04-231-0/+2
| | | | | Signed-off-by: Louis Bouchard <louis.bouchard@canonical.com> Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
* Add collection for squid-deb-proxy if presentLouis Bouchard2014-04-231-1/+3
| | | | | Signed-off-by: Louis Bouchard <louis.bouchard@canonical.com> Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
* Fix pep8 complaintsLouis Bouchard2014-04-231-2/+5
| | | | | Signed-off-by: Louis Bouchard <louis.bouchard@canonical.com> Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
* Handle compressed sar binary data files betterPeter Portante2014-04-191-14/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | We now collect all compressed and uncompressed sar?? and sa?? data files. Given that tailing the text output is not very useful, we add an option to not perform the tail when we have reached the limit. NOTES: * The 20 MB limit applies to each *set* of files being collected, so there there is a 20 MB limit for the total number of sa??* files and _separate_ 20 MB limit for sar??* files collected * The 20 MB limit *does not apply* to the generated command output, so if there is a 200+ MB sa?? data file present, that file won't be collected, but the resulting 200+ MB sar?? and sar??.xml files will still be collected in full * The generated command output for missing sar files is only generated from uncompressed binary data files * The generated command output for the XML files is also only generated from uncompressed binary data files Signed-off-by: Peter Portante <peter.portante@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Add parameter to add_copy_spec_limit() to control tail behaviorBryn M. Reeves2014-04-191-3/+3
| | | | | | | | | | Allow callers of add_copy_spec_limit() to disable collection of the tail of a file when the limit is reached. This is not useful for most binary data formats and even many text formats. Based on a patch from Peter Portante <peter.portante@redhat.com>. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Use os.path.join instead of hardcoded formattingPeter Portante2014-04-171-5/+5
| | | | Signed-off-by: Peter Portante <peter.portante@redhat.com>
* Handle KeyboardInterrupt during policy loadBryn M. Reeves2014-04-161-1/+4
| | | | | | | | | | Loading the policy class accounts for most of the time sos spends before outputing any UI text. Handle Ctrl-C during this period and exit gracefully. Fixes Issue #270. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Handle IOError exceptions in SoSReportBryn M. Reeves2014-04-161-16/+18
| | | | | | | Write operations raise IOError instead of OSError and do not expose a filename attribute. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Handle fatal file system errors in SoSReport.final_work()Bryn M. Reeves2014-04-161-0/+7
| | | | | | | | | | Out-of-space and read-only file system errors while creating the compressed archive should be treated as fatal and cause the run to end. Partial fix for Issue #266. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Handle fatal file system errors in SoSReport.postproc()Bryn M. Reeves2014-04-161-0/+7
| | | | | | | | | Out-of-space and read-only file system errors from plugins should be treated as fatal and cause the run to end. Partial fix for Issue #266. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Handle fatal file system errors in SoSReport.*report()Bryn M. Reeves2014-04-161-8/+32
| | | | | | | | | | Out-of-space and read-only file system errors while writing the XML, plain-text, or HTML reports should be treated as fatal and cause the run to end. Partial fix for Issue #266. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Handle fatal file system errors in SoSReport.collect()Bryn M. Reeves2014-04-161-0/+7
| | | | | | | | | Out-of-space and read-only file system errors from plugins should be treated as fatal and cause the run to end. Partial fix for Issue #266. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Don't handle exceptions in do_copy_path()Bryn M. Reeves2014-04-161-15/+8
| | | | | | | | | Allow the main SoSReport class to handle exceptions that occur while calling a plugin's setup() and collect() methods. Partial fix for Issue #266. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Handle fatal file system errors in SoSReport.setup()Bryn M. Reeves2014-04-161-1/+10
| | | | | | | | | Out-of-space and read-only file system errors from plugins should be treated as fatal and cause the run to end. Partial fix for Issue #266. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Check for file system errors when setting up archiveBryn M. Reeves2014-04-161-2/+10
| | | | | | | Check for ENOSPC and EROFS when setting up the archive directory structure and exit with failure and an error message. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Log an error and exit with non-zero status if archive setup failsBryn M. Reeves2014-04-161-2/+3
| | | | | | | | | Currently unexpected exceptions during archive setup log a python backtrace and exit with success. Exit with failure (1) when this happens and log a message indicating the exception is unhandled before printing the backtrace. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Remove useless else on loop statement in TarFileArchiveBryn M. Reeves2014-04-161-2/+1
| | | | Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Fix command parameter aliasing and exception handlingBryn M. Reeves2014-04-161-11/+12
| | | | | | | | | | | | | | | | | | | | | | | | The addition of 'runat' exposed a bug in the parameter passing for commands. We pack a tuple into a list in add_cmd_output() and then unpack it in collect_cmd_output(). These functions need to be careful in the use of positional vs. keyword arguments; passing keywords as though they were positional can lead to e.g. an integer timeout value appearing in the tuple member for 'suggest_filename' causing an exception when we attempt to pass the value to get_cmd_output_now(). Fix this by ensuring that all keyword args are passed explicitly through these functions and improve the debug logging by printing the tuple we are packing/unpacking. This also removes the exception handling block from the function collect_cmd_output() - this routine should allow exceptions to propagate up so that they can be handled by the --debug logic. The 'command not found' case is already logged in the generic get_command_output() wrapper. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Use uft-8 encoding for archive IOBryn M. Reeves2014-04-161-2/+3
| | | | | | | | | | | | When reading and writing files within the archive class use the codecs module and set the 'utf-8' encoding. This prevents encoding exceptions if a plugin passes a unicode string to add_string() or if a plugin attempts to read unicode encoded data from an archive file via the open_file() method. Fixes Issue #275. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Fix style and formatting in Plugin classBryn M. Reeves2014-04-151-50/+36
| | | | | | | | Make code formatting more consistent and readable by removing very long lines and using consistent style for multi-line function prototypes and calls. Also fix a couple of comment typos. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Format the add_copy_specs method in juju pluginAdam Stokes2014-04-151-2/+4
| | | | Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
* Remove deb tasks in MakefileAdam Stokes2014-04-151-4/+0
| | | | | | | | | | | Isn't really necessary anymore since we have an automated build kick off everytime a commit is made. https://code.launchpad.net/~sosreport/+archive/ppa Closes #234 Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
* Foward maas patch code to latest trunk and update authorsAdam Stokes2014-04-152-0/+30
|\ | | | | | | | | | | | | Closes #272 Signed-off-by: Jorge Niedbalski <jnr@metaklass.org> Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
| * [plugins/maas] added `maas commissioning list` output to the command output listJorge Niedbalski R2014-04-151-0/+29
| |
* | Add OPAL log to collected file listJoel Stanley2014-04-151-1/+2
| | | | | | | | | | | | | | | | | | The OPAL console log used to live under /sys/kernel/debug/powerpc so it was collected as part of that glob. This patch adds the new location at /sys/firmware/opal/msglog to the list of collected files. Signed-off-by: Joel Stanley <joel@jms.id.au> Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
* | Dont double import logging moduleAdam Stokes2014-04-141-1/+0
| | | | | | | | | | | | Probably doesnt matter but for cleanliness sake. Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
* | Fix debugfs_path usage in kvm pluginBryn M. Reeves2014-04-141-2/+2
| | | | | | | | Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* | Fix dmraid metadata collection and make it optionalBryn M. Reeves2014-04-141-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | The dmraid command writes metadata dumps into the current working directory. This is normally /tmp meaning that the files are created outside the archive. Use runat to change directory to the appropriate path in the archive before running the command and add an option to control metadata collection. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* | Document dmraid optionsBryn M. Reeves2014-04-141-0/+7
| | | | | | | | Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* | Remove shell pipeline from OpenStack Nova pluginBryn M. Reeves2014-04-141-1/+1
| | | | | | | | Signed-off-by: Bryn M. Reeves <bmr@redhat.com>