]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
cgroup.py: Fix potential undeclared variable
authorTom Hromatka <tom.hromatka@oracle.com>
Fri, 18 Mar 2022 14:00:12 +0000 (08:00 -0600)
committerTom Hromatka <tom.hromatka@oracle.com>
Wed, 23 Mar 2022 15:12:25 +0000 (09:12 -0600)
Due to the try/except and if/else paths in snapshot(),
the variable res may not be declared before reaching the
return statement.  In the case where it's undeclared,
re-raise the exception.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
ftests/cgroup.py

index c252d8b5733bc73478ba74e056a538e8e6ae3073..75d15b8b647ee259881a9995b5700cc429eea109 100644 (file)
@@ -556,6 +556,8 @@ class Cgroup(object):
             if re.ret == 0 and \
                'neither blacklisted nor whitelisted' in re.stderr:
                 res = re.stdout
+            else:
+                raise(re)
 
         # convert the cgsnapshot stdout to a dict of cgroup objects
         return Cgroup.snapshot_to_dict(res)