[PATCH 51/74] If a user specifies a module to add that does not exist

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

 



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

Improve error handling in semanage to not rely on the library to report
errors, but give better user feedback.

   This patch looks good to me. acked.

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

iEYEARECAAYFAlJpNd4ACgkQrlYvE4MpobNYnwCg3BSmrit6DZhn9WLbwZNSVJRK
CXsAn2hv1X0s6Sa4joQY3RfobquIcoWH
=2OCW
-----END PGP SIGNATURE-----
>From 6ec59b3cbc5657afa0857ff4764559c0ab9c655a Mon Sep 17 00:00:00 2001
From: Dan Walsh <dwalsh@xxxxxxxxxx>
Date: Fri, 11 Oct 2013 08:54:16 -0400
Subject: [PATCH 51/74] If a user specifies a module to add that does not exist
 print error.

Currently we wait for libsemange to give us a random error, this gives a clean
error
---
 policycoreutils/semanage/seobject.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/policycoreutils/semanage/seobject.py b/policycoreutils/semanage/seobject.py
index 7bea397..6bd36ee 100644
--- a/policycoreutils/semanage/seobject.py
+++ b/policycoreutils/semanage/seobject.py
@@ -308,6 +308,8 @@ class moduleRecords(semanageRecords):
                        print "%-25s%-10s%s" % (t[0], t[1], disabled)
 
 	def add(self, file):
+               if not os.path.exists(file):
+                       raise ValueError(_("Module does not exists %s ") % file)
                rc = semanage_module_install_file(self.sh, file);
                if rc >= 0:
                       self.commit()
-- 
1.8.3.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