From e22f8fd49026ab4d162b835fdf80609949039bcb Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Fri, 14 Sep 2012 15:55:28 -0400 Subject: SEModules: fixed some bits of module handling --- src/lib/Bcfg2/Client/Tools/SELinux.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/lib/Bcfg2/Client/Tools') diff --git a/src/lib/Bcfg2/Client/Tools/SELinux.py b/src/lib/Bcfg2/Client/Tools/SELinux.py index 018a7eae4..f060a1374 100644 --- a/src/lib/Bcfg2/Client/Tools/SELinux.py +++ b/src/lib/Bcfg2/Client/Tools/SELinux.py @@ -703,8 +703,14 @@ class SELinuxModuleHandler(SELinuxEntryHandler): return rv def _filepath(self, entry): - return os.path.join("/usr/share/selinux", self.setype, - "%s.pp" % entry.get("name")) + path = os.path.join("/usr/share/selinux", self.setype, + entry.get("name").lstrip("/")) + if not path.endswith(".pp"): + # the entry name we get from the SEModules plugin should + # always have .pp on the end, but we double check just to + # make absolutely certain + path = path + ".pp" + return path def _pathentry(self, entry): pathentry = copy.deepcopy(entry) @@ -744,7 +750,7 @@ class SELinuxModuleHandler(SELinuxEntryHandler): def _install_seobject(self, entry): try: if not SELinuxEntryHandler.Install(self, entry): - return false + return False except NameError: # some versions of selinux have a bug in seobject that # makes modify() calls fail. add() seems to have the same @@ -765,7 +771,7 @@ class SELinuxModuleHandler(SELinuxEntryHandler): try: proc = Popen(['semodule', '-i', self._filepath(entry)], stdout=PIPE, stderr=PIPE) - out, err = proc.communicate() + err = proc.communicate()[1] rv = proc.wait() except OSError: err = sys.exc_info()[1] -- cgit v1.2.3-1-g7c22