aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2015-01-27 11:40:06 +0000
committerBryn M. Reeves <bmr@redhat.com>2015-07-08 17:05:22 +0100
commitd34bf4982f8a627901f6538be3b9e52cc30fe91b (patch)
tree96216060a61b223fb316ca5ee38af6de172e0590
parent6a239ddeb5de9a04e7e7081ea6425d89dddda3f5 (diff)
downloadsos-d34bf4982f8a627901f6538be3b9e52cc30fe91b.tar.gz
[sosoptions] ensure '_sysroot' and '_chroot' are initialised
Make sure the sysroot and chroot members of the SoSOptions object are initialised to prevent exceptions when these are not set on the command line: sosreport Traceback (most recent call last): File "/usr/sbin/sosreport", line 25, in <module> main(sys.argv[1:]) File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 1490, in main sos = SoSReport(args) File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 673, in __init__ self.policy = sos.policies.load(sysroot=self.opts.sysroot) File "/usr/lib/python2.7/site-packages/sos/policies/__init__.py", line 40, in load cache['policy'] = policy(sysroot=sysroot) File "/usr/lib/python2.7/site-packages/sos/policies/redhat.py", line 192, in __init__ super(FedoraPolicy, self).__init__(sysroot=sysroot) File "/usr/lib/python2.7/site-packages/sos/policies/redhat.py", line 58, in __init__ if self.package_manager.all_pkgs()['filesystem']['version'][0] == '3': File "/usr/lib/python2.7/site-packages/sos/policies/__init__.py", line 116, in all_pkgs self.packages = self.get_pkg_list() File "/usr/lib/python2.7/site-packages/sos/policies/__init__.py", line 99, in get_pkg_list pkg_list = shell_out(cmd, chroot=self.chroot).splitlines() File "/usr/lib/python2.7/site-packages/sos/utilities.py", line 191, in shell_out return sos_get_command_output(cmd, chroot=chroot, chdir=runat)['output'] File "/usr/lib/python2.7/site-packages/sos/utilities.py", line 156, in sos_get_command_output raise e OSError: [Errno 1] Operation not permitted: '/' Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/sosreport.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/sos/sosreport.py b/sos/sosreport.py
index ad13a2d2..27c756f7 100644
--- a/sos/sosreport.py
+++ b/sos/sosreport.py
@@ -251,6 +251,8 @@ class SoSOptions(object):
_config_file = ""
_tmp_dir = ""
_report = True
+ _sysroot = None
+ _chroot = 'auto'
_compression_type = 'auto'
_options = None