[PATCH 56/84] policycoreutils: semanage: good error message is

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


   This patch looks good to me. acked.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlD+p9oACgkQrlYvE4MpobNC6ACfd4r9EHwUz5WiAZsOUBh44e0p
/70AnRMNF3AMcHLN+9fkr5d2UMgEm4LA
=85y8
-----END PGP SIGNATURE-----
>From f4386ef552501fba49a9bb49e63f3d9df3b79aa5 Mon Sep 17 00:00:00 2001
From: Dan Walsh <dwalsh@xxxxxxxxxx>
Date: Mon, 19 Nov 2012 16:10:27 -0500
Subject: [PATCH 56/84] policycoreutils: semanage: good error message is
 sepolgen python module missing

We only need the sepolgen python module if we are setting up permissive
types.  As this has been removed from the core code in Fedora/RHEL we
include a better user error message pointing them how to find the
required module.

Signed-off-by: Eric Paris <eparis@xxxxxxxxxx>
---
 policycoreutils/semanage/semanage    | 4 ++--
 policycoreutils/semanage/seobject.py | 8 ++++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/policycoreutils/semanage/semanage b/policycoreutils/semanage/semanage
index 61d455c..49e4709 100644
--- a/policycoreutils/semanage/semanage
+++ b/policycoreutils/semanage/semanage
@@ -376,8 +376,8 @@ Object-specific Options (see above):
 			OBJECT = seobject.moduleRecords(store)
 
 		if object == "permissive":
-			OBJECT = seobject.permissiveRecords(store)
-		
+                       OBJECT = seobject.permissiveRecords(store)
+
 		if object == "dontaudit":
                         OBJECT = seobject.dontauditClass(store)
 
diff --git a/policycoreutils/semanage/seobject.py b/policycoreutils/semanage/seobject.py
index 05b8128..d31bdef 100644
--- a/policycoreutils/semanage/seobject.py
+++ b/policycoreutils/semanage/seobject.py
@@ -27,7 +27,6 @@ PROGNAME = "policycoreutils"
 import sepolicy
 from sepolicy import boolean_desc, boolean_category, gen_bool_dict
 gen_bool_dict()
-import sepolgen.module as module
 from IPy import IP
 
 import gettext
@@ -257,7 +256,7 @@ class semanageRecords:
 
 class moduleRecords(semanageRecords):
 	def __init__(self, store):
-               semanageRecords.__init__(self, store)
+	       semanageRecords.__init__(self, store)
 
 	def get_all(self):
                l = []
@@ -374,6 +373,11 @@ class permissiveRecords(semanageRecords):
 
 	def add(self, type):
                import glob
+	       try:
+		       import sepolgen.module as module
+	       except ImportError:
+		       raise ValueError(_("The sepolgen python module is required to setup permissive domains.\nIn some distributions it is included in the policycoreutils-devel patckage.\n# yum install policycoreutils-devel\nOr similar for your distro."))
+		
                name = "permissive_%s" % type
                dirname = "/var/lib/selinux"
                os.chdir(dirname)
-- 
1.8.1


[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux