[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.6-1-356-g5718585

James Turnbull james at lovedthanlost.net
Fri Jan 23 14:21:37 UTC 2009


The following commit has been merged in the master branch:
commit 71a9e60396b1a4964c21308ce3a8bdddc97a721e
Author: Sean E. Millichamp <sean at bruenor.org>
Date:   Thu Nov 6 10:43:19 2008 -0500

    Fixes relating to transition to native SELinux bindings

diff --git a/lib/puppet/type/file/selcontext.rb b/lib/puppet/type/file/selcontext.rb
index d5111ca..982910c 100644
--- a/lib/puppet/type/file/selcontext.rb
+++ b/lib/puppet/type/file/selcontext.rb
@@ -50,6 +50,13 @@ module Puppet
                 end
             end
 
+            selcontext = self.should
+
+            if selcontext == :absent
+                # This is only valid for create states...
+                return nil
+            end
+
             self.set_selinux_context(@resource[:path], @should, name)
             return :file_changed
         end
diff --git a/lib/puppet/util/selinux.rb b/lib/puppet/util/selinux.rb
index b181b35..0df1373 100644
--- a/lib/puppet/util/selinux.rb
+++ b/lib/puppet/util/selinux.rb
@@ -44,8 +44,15 @@ module Puppet::Util::SELinux
         unless selinux_support?
             return nil
         end
-        filestat = File.lstat(file)
-        retval = Selinux.matchpathcon(file, filestat.mode)
+        # If the file exists we should pass the mode to matchpathcon for the most specific
+        # matching.  If not, we can pass a mode of 0.
+        begin
+            filestat = File.lstat(file)
+            mode = filestat.mode
+        rescue Errno::ENOENT
+            mode = 0
+        end
+        retval = Selinux.matchpathcon(file, mode)
         if retval == -1
             return nil
         end

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list