aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* | Remove shell redirects from OpenStack Nova pluginBryn M. Reeves2014-04-141-8/+8
| | | | | | | | | | | | | | Shell redirect syntax is no longer supported and will fail. Remove its use from the OpenStack Nova plugin. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* | Add default Plugin.setup() methodBryn M. Reeves2014-04-143-8/+4
|/ | | | | | | | | | | | | | | | | | | Adding a default setup() method to the base Plugin class allows useful plugins to be written declaratively by setting the 'files' and 'packages' members of the subclass, e.g.: class FooPlugin(Plugin): plugin_name = 'foo' packages = ('foo',) files = ('/etc/foo.conf',) Creates a plugin class named 'foo' that will run whenever the 'foo' package is installed or the '/etc/foo.conf' file exists. The method calls self.add_copy_specs() with the plugin's files list. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Really fix file and command collection regressionsBryn M. Reeves2014-04-105-8/+8
| | | | | | | | | | | | | | | | | | | | | | | Previous patch was missing the hunks for plugins other than usb: modified: sos/plugins/general.py modified: sos/plugins/logs.py modified: sos/plugins/networking.py modified: sos/plugins/qpid.py modified: sos/plugins/s390.py The automation used to convert to add_copy_specs() and add_cmd_outputs() left a few missing and stray commas in file and command lists, for e.g. causing two lsusb commands to be concatenated: Running 71/74: usb... [plugin:usb] collecting path '/sys/bus/usb' [plugin:usb] collecting output of 'lsusblsusb -v' [plugin:usb] collecting output of 'lsusb -t' Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Fix file and command collection regressionsBryn M. Reeves2014-04-091-1/+1
| | | | | | | | | | | | | | The automation used to convert to add_copy_specs() and add_cmd_outputs() left a few missing and stray commas in file and command lists, for e.g. causing two lsusb commands to be concatenated: Running 71/74: usb... [plugin:usb] collecting path '/sys/bus/usb' [plugin:usb] collecting output of 'lsusblsusb -v' [plugin:usb] collecting output of 'lsusb -t' Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Combine debian and ubuntu basic log gathering classesAdam Stokes2014-04-091-11/+2
| | | | | | | The plugin list shows logs twice for Ubuntu and Debian systems. Since the variations between the 2 are minimal we are combining those classes. Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
* Replace os.system() in gluster plugin with self.check_ext_prog()Bryn M. Reeves2014-04-081-8/+9
| | | | | | | | Plugins should not open-code calls to external commands. Use the build-in check_ext_prog() interface instead and test for success before attempting to collect the statedump files. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Allow failures for python 3.4 on travis-ciAdam Stokes2014-04-071-0/+3
| | | | | | | | Looks like python 3.4 is not ready available on travis-ci.org. We'll make 3.4 unit testing a requirement once travis-ci makes python 3.4 an available environment. Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
* Bring python 3.4 into the testing matrixAdam Stokes2014-04-071-0/+1
| | | | Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
* Merge pull request #265 from karibou/fix_interfaces.dBryn M. Reeves2014-04-071-0/+1
|\ | | | | Add collection of /etc/network/interfaces.d for Ubuntu
| * Add collection of /etc/network/interfaces.d for UbuntuLouis Bouchard2014-04-071-0/+1
|/ | | | | | | | Since 14.04 Trusty, ubuntu uses config scripts in /etc/network/interfaces.d. Collect those. Closes: #264 Signed-off-by: Louis Bouchard <louis.bouchard@canonical.com>
* Add add_cmd_outputs() and convert plugins to use itBryn M. Reeves2014-04-0685-696/+950
| | | | | | | | | | Add a new method to Plugin to add a list of commands to be run, analogous to add_copy_specs() vs add_copy_spec(). Also convert a few plugins not using add_copy_specs() for long file lists (or using it inconsistently). Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Handle ENOENT in sos_get_command_output()Bryn M. Reeves2014-04-061-1/+8
| | | | Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Call Popen with shell=FalseBryn M. Reeves2014-04-061-1/+3
| | | | | | Fixes Issue #253. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Make rpm plugin call sh -c'...'Bryn M. Reeves2014-04-061-6/+6
| | | | | | | The rpm plugin is the last user of shell syntax. For now have it call its pipeline explicitly using sh -c '...'. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Make OpenShift plugin use the runat parameterBryn M. Reeves2014-04-061-1/+2
| | | | | | | | | | OpenShift uses 'cd /path && cmd' in a call to add_cmd_output(). Replace this with the runat paramter and avoid shell syntax in the plugin. Related: Issue #253. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Add 'runat' parameter to command output interfacesBryn M. Reeves2014-04-062-14/+36
| | | | | | | | | Add a new 'runat' parameter sos_get_command_output() to specify a directory for the child to switch to before executing the given command and propagate this through the various command output collection interfaces. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Remove pipe use from autofs pluginBryn M. Reeves2014-04-061-3/+0
| | | | | | | | | This is redundant since the whole ps and mount output is captured elsewhere. Also removes shell syntax from the plugin. Related: Issue #253. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Remove pipe use from soundcard pluginBryn M. Reeves2014-04-061-3/+0
| | | | | | | | | This is redundant since the whole lspci and lsmod output is captured elsewhere. Also removes shell syntax from the plugin. Related: Issue #253. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Remove dmesg|grep use from memory pluginBryn M. Reeves2014-04-061-3/+0
| | | | | | | | | | This is redundant since the whole boottime dmesg (and current dmesg buffer) are captured elsewhere. Also removes shell syntax from the plugin. Related: Issue #253. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Restore generic UI preamble textBryn M. Reeves2014-04-062-11/+27
| | | | | | | | | | The generic UI text in the policy base class was replaced with the Red Hat Enterprise Linux wording in commit c59877c. The wording isn't suitable for all distributions so revert this part of the commit and move the RHEL text back to the RHEL-specific policy class. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Logging improvementsBryn M. Reeves2014-04-068-44/+93
| | | | | | | | | | | | | | | | | Improve logging output and make consistent use of log levels in plugin code. Log messages for the archive and plugin classes now use their own class-level logging interface to prefix messages with a label indicating the message source, e.g.: [plugin:yum] collecting output of 'yum -C repolist' [archive:TarFileArchive] finalizing archive '/var/tmp/sosreport-f20-vm1-20140406162540' Convert existing plugin and archive code to use the new interfaces. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Handle copystat() exceptions in FileCacheArchive.add_string()Bryn M. Reeves2014-04-061-0/+3
| | | | | | | | Since add_string() attempts to copystat() strings that exist in the host file system it also needs to check for PermissionError exceptions. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Make add_file() exception logging consistentBryn M. Reeves2014-04-061-3/+3
| | | | Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Break up exception handling in FileCacheArchive.add_file()Bryn M. Reeves2014-04-061-2/+9
| | | | | | | | | | | | | | An exception can occur at several points in add_file() - Copying the source to the destination - Propagating permissions with shutil.copystat - Setting ownership via os.chown The second of these can occur when copying SELinux xattrs from /proc. Separate out the three cases and ignore failures in copystat. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Fix typo in PowerPC pluginBryn M. Reeves2014-04-061-2/+2
| | | | Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* Update references to github URLBryn M. Reeves2014-04-065-6/+6
| | | | | | Update URLs to reflect repository rename to 'sos'. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>