From: Laurent Bigonville <bigon@debian.org>
To: selinux@tycho.nsa.gov
Subject: [PATCH 1/2] Sandbox: Use next() over the sepolicy.info() result
Date: Mon, 7 Nov 2016 09:01:16 +0100 [thread overview]
Message-ID: <20161107080117.24030-1-bigon@debian.org> (raw)
From: Laurent Bigonville <bigon@bigon.be>
sepolicy.info() now returns a generator, use next() to get the results.
Signed-off-by: Laurent Bigonville <bigon@bigon.be>
---
policycoreutils/sandbox/sandbox | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/policycoreutils/sandbox/sandbox b/policycoreutils/sandbox/sandbox
index 4010e83..c07a1d8 100644
--- a/policycoreutils/sandbox/sandbox
+++ b/policycoreutils/sandbox/sandbox
@@ -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:
--
2.10.2
next reply other threads:[~2016-11-07 8:01 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-07 8:01 Laurent Bigonville [this message]
2016-11-07 8:01 ` [PATCH 2/2] policycoreutils: Make sepolicy work with python3 Laurent Bigonville
2016-11-07 9:51 ` [Patch v2 " Laurent Bigonville
2016-11-08 15:21 ` Stephen Smalley
2016-11-08 15:29 ` Stephen Smalley
2016-11-11 0:58 ` Chris PeBenito
2016-11-13 16:20 ` Nicolas Iooss
2016-11-13 18:56 ` Chris PeBenito
2016-11-08 15:35 ` Stephen Smalley
2016-11-07 21:13 ` [PATCH 1/2] Sandbox: Use next() over the sepolicy.info() result Stephen Smalley
2016-11-07 23:09 ` Laurent Bigonville
2016-11-08 13:34 ` Stephen Smalley
2016-11-08 14:57 ` Stephen Smalley
2016-11-08 14:58 ` Laurent Bigonville
2016-11-08 15:08 ` Stephen Smalley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161107080117.24030-1-bigon@debian.org \
--to=bigon@debian.org \
--cc=selinux@tycho.nsa.gov \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.