mirror of
https://github.com/SELinuxProject/selinux
synced 2025-03-25 12:16:42 +00:00
Sandbox: Use next() over the sepolicy.info() result
sepolicy.info() now returns a generator, use next() to get the results. Signed-off-by: Laurent Bigonville <bigon@bigon.be>
This commit is contained in:
parent
b42a293978
commit
eed0e4259f
@ -305,8 +305,8 @@ kill -TERM $WM_PID 2> /dev/null
|
||||
types = _("""
|
||||
Policy defines the following types for use with the -t:
|
||||
\t%s
|
||||
""") % "\n\t".join(list(sepolicy.info(sepolicy.ATTRIBUTE, "sandbox_type"))[0]['types'])
|
||||
except RuntimeError:
|
||||
""") % "\n\t".join(next(sepolicy.info(sepolicy.ATTRIBUTE, "sandbox_type"))['types'])
|
||||
except StopIteration:
|
||||
pass
|
||||
|
||||
usage = _("""
|
||||
@ -380,8 +380,8 @@ sandbox [-h] [-l level ] [-[X|M] [-H homedir] [-T tempdir]] [-I includefile ] [-
|
||||
self.setype = DEFAULT_X_TYPE
|
||||
else:
|
||||
try:
|
||||
sepolicy.info(sepolicy.TYPE, "sandbox_t")
|
||||
except RuntimeError:
|
||||
next(sepolicy.info(sepolicy.TYPE, "sandbox_t"))
|
||||
except StopIteration:
|
||||
raise ValueError(_("Sandbox Policy is not currently installed.\nYou need to install the selinux-policy-sandbox package in order to run this command"))
|
||||
|
||||
if self.__options.setype:
|
||||
|
Loading…
Reference in New Issue
Block a user