[sos-devel] [PATCH] [policies] Adopt --sysroot from RedHat policy class

Kamalesh Babulal kamalesh at linux.vnet.ibm.com
Thu May 12 07:48:13 UTC 2016


commit 6a239ddeb5de (pass --sysroot down to policy classes),
passes sysroot as part of init to RedHat policy. PowerKVMPolicy
and ZKVMPolicy are subclasses derived from RedHat policy,
so pass sysroot to them too.

if sysroot is not passed to the subclasses, following exception
is triggered:
Traceback (most recent call last):
  File "./sosreport", line 25, in <module>
    main(sys.argv[1:])
  File "/root/rpmbuild/BUILD/sos/sos/sosreport.py", line 1635, in main
    sos = SoSReport(args)
  File "/root/rpmbuild/BUILD/sos/sos/sosreport.py", line 697, in __init__
    self.policy = sos.policies.load(sysroot=self.opts.sysroot)
  File "/root/rpmbuild/BUILD/sos/sos/policies/__init__.py", line 38, in load
    cache['policy'] = policy(sysroot=sysroot)
TypeError: __init__() got an unexpected keyword argument 'sysroot'

Signed-off-by: Kamalesh Babulal <kamalesh at linux.vnet.ibm.com>
---
 sos/policies/ibmkvm.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sos/policies/ibmkvm.py b/sos/policies/ibmkvm.py
index ff059532d528..c93f96061378 100644
--- a/sos/policies/ibmkvm.py
+++ b/sos/policies/ibmkvm.py
@@ -29,8 +29,8 @@ class PowerKVMPolicy(RedHatPolicy):
     vendor = "IBM"
     vendor_url = "http://www-03.ibm.com/systems/power/software/linux/powerkvm"
 
-    def __init__(self):
-        super(PowerKVMPolicy, self).__init__()
+    def __init__(self, sysroot=None):
+        super(PowerKVMPolicy, self).__init__(sysroot=sysroot)
         self.valid_subclasses = [PowerKVMPlugin, RedHatPlugin]
 
     @classmethod
@@ -54,8 +54,8 @@ class ZKVMPolicy(RedHatPolicy):
     vendor = "IBM Hypervisor"
     vendor_url = "http://www.ibm.com/systems/z/linux/IBMHypervisor/support/"
 
-    def __init__(self):
-        super(ZKVMPolicy, self).__init__()
+    def __init__(self, sysroot=None):
+        super(ZKVMPolicy, self).__init__(sysroot=sysroot)
         self.valid_subclasses = [ZKVMPlugin, RedHatPlugin]
 
     @classmethod
-- 
2.6.0.rc1




More information about the sos-devel mailing list