File rtslib-fix_support_for_disabled_tpgs.patch of Package python-rtslib.1545

Index: rtslib-2.2/rtslib/target.py
===================================================================
--- rtslib-2.2.orig/rtslib/target.py
+++ rtslib-2.2/rtslib/target.py
@@ -1002,11 +1002,12 @@ class TPG(CFSNode):
         '''
         self._check_self()
         path = "%s/enable" % self.path
-        if os.path.isfile(path) and (boolean != self._get_enable()):
-            try:
-                fwrite(path, str(int(boolean)))
-            except IOError, e:
-                raise RTSLibError("Cannot change enable state: %s" % e)
+        if os.path.isfile(path):
+            if (boolean != self._get_enable()):
+                try:
+                    fwrite(path, str(int(boolean)))
+                except IOError, e:
+                    raise RTSLibError("Cannot change enable state: %s" % e)
         elif not boolean:
             raise RTSLibError("TPG cannot be disabled.")
 
openSUSE Build Service is sponsored by