Signed-off-by: James Turnbull <ja...@lovedthanlost.net>
---
 CHANGELOG                          |    2 ++
 lib/puppet/type/file/selcontext.rb |    8 ++++++++
 spec/unit/type/file/selinux.rb     |    6 ++++++
 3 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 30fc1c6..55915c2 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,6 @@
 0.25.x
+    Fixed #1852 - Correct behaviour when no SELinux bindings
+ 
     Updated Red Hat spec file 0.24.7
 
 0.24.7
diff --git a/lib/puppet/type/file/selcontext.rb 
b/lib/puppet/type/file/selcontext.rb
index 22e3080..9900350 100644
--- a/lib/puppet/type/file/selcontext.rb
+++ b/lib/puppet/type/file/selcontext.rb
@@ -44,6 +44,14 @@ module Puppet
             return property_default
         end
 
+        def insync?(value)
+            if not selinux_support?
+              debug("SELinux bindings not found. Ignoring parameter.")
+              return true
+            end
+            super
+        end
+
         def sync
             self.set_selinux_context(@resource[:path], @should, name)
             return :file_changed
diff --git a/spec/unit/type/file/selinux.rb b/spec/unit/type/file/selinux.rb
index a97f9bc..4c16fe5 100644
--- a/spec/unit/type/file/selinux.rb
+++ b/spec/unit/type/file/selinux.rb
@@ -74,6 +74,12 @@ Dir.chdir(File.dirname(__FILE__)) { (s = lambda { |f| 
File.exist?(f) ? require(f
             @sel.sync
         end
 
+        it "should do nothing for insync? if no SELinux support" do
+            @sel.should = %{newcontext}
+            @sel.expects(:selinux_support?).returns false
+            @sel.insync?("oldcontext").should == true
+        end
+
         after do
             Puppet::Type.type(:file).clear
         end
-- 
1.6.0.6


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to puppet-dev@googlegroups.com
To unsubscribe from this group, send email to 
puppet-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to