diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2014-04-16 20:34:11 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2014-04-16 20:36:42 +0100 |
commit | 4e5c9372113656866b5cd6ad01a8e57fc5f5af52 (patch) | |
tree | 8b889584c6ba753020f806b2dae0d521ae4286c7 | |
parent | c719653e4d68a0910f66922753d539fbfc874853 (diff) | |
download | sos-4e5c9372113656866b5cd6ad01a8e57fc5f5af52.tar.gz |
Check for file system errors when setting up archive
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>
-rw-r--r-- | sos/sosreport.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sos/sosreport.py b/sos/sosreport.py index c3b2f421..0ae82936 100644 --- a/sos/sosreport.py +++ b/sos/sosreport.py @@ -35,6 +35,7 @@ supplied for application-specific information import sys import traceback import os +import errno import logging from optparse import OptionParser, Option from sos.plugins import import_plugin @@ -903,17 +904,24 @@ class SoSReport(object): self.soslog.error("%s\n%s" % (plugin_name, traceback.format_exc())) def prework(self): + self.policy.pre_work() try: - self.policy.pre_work() self.ui_log.info(_(" Setting up archive ...")) self._set_archive() self._make_archive_paths() + return + except OSError as e: + if e.errno in (errno.ENOSPC, errno.EROFS): + self.ui_log.error("") + self.ui_log.error(" %s while setting up archive" % e.strerror) + self.ui_log.error(" %s" % e.filename) except Exception as e: import traceback + self.ui_log.error("") self.ui_log.error(" Unexpected exception setting up archive:") traceback.print_exc(e) self.ui_log.error(e) - self._exit(1) + self._exit(1) def setup(self): self.ui_log.info(_(" Setting up plugins ...")) |