[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. puppet-0.24.5-rc3-1601-gf8c1b08
Markus Roberts
Markus at reality.com
Fri Jan 15 09:07:58 UTC 2010
The following commit has been merged in the upstream branch:
commit d11c7503cc816e98b5deb890b49a7e8c47173e1b
Author: Markus Roberts <Markus at reality.com>
Date: Fri Dec 18 09:11:09 2009 -0800
Fix for #2951 (SELinux test errors on OS X)
This makes the SELinux library marginally more robust by dealing
consistently with a missing proc/mounts, and also resoves the test
failures in a way that allows meaningful test runs on non-SELinux
systems.
Signed-off-by: Markus Roberts <Markus at reality.com>
diff --git a/lib/puppet/util/selinux.rb b/lib/puppet/util/selinux.rb
index 331c8eb..628a6ec 100644
--- a/lib/puppet/util/selinux.rb
+++ b/lib/puppet/util/selinux.rb
@@ -166,8 +166,8 @@ module Puppet::Util::SELinux
# that's expected
rescue
return nil
- ensure
- mountfh.close
+ ensure
+ mountfh.close if mountfh
end
mntpoint = {}
diff --git a/spec/unit/util/selinux.rb b/spec/unit/util/selinux.rb
index 7e6cdaf..88f4ac8 100755
--- a/spec/unit/util/selinux.rb
+++ b/spec/unit/util/selinux.rb
@@ -27,7 +27,12 @@ describe Puppet::Util::SELinux do
Selinux.expects(:is_selinux_enabled).returns 0
selinux_support?.should be_false
end
- end
+
+ it "should return nil if /proc/mounts does not exist" do
+ File.stubs(:open).with("/proc/mounts").raises("No such file or directory - /proc/mounts")
+ read_mounts.should == nil
+ end
+ end
describe "filesystem detection" do
before :each do
@@ -189,7 +194,19 @@ describe Puppet::Util::SELinux do
end
describe "set_selinux_context" do
- it "should return nil if there is no SELinux support" do
+ before :each do
+ fh = stub 'fh', :close => nil
+ File.stubs(:open).with("/proc/mounts").returns fh
+ fh.stubs(:read_nonblock).returns(
+ "rootfs / rootfs rw 0 0\n"+
+ "/dev/root / ext3 rw,relatime,errors=continue,user_xattr,acl,data=ordered 0 0\n"+
+ "/dev /dev tmpfs rw,relatime,mode=755 0 0\n"+
+ "/proc /proc proc rw,relatime 0 0\n"+
+ "/sys /sys sysfs rw,relatime 0 0\n"
+ ).then.raises EOFError
+ end
+
+ it "should return nil if there is no SELinux support" do
self.expects(:selinux_support?).returns false
set_selinux_context("/foo", "user_u:role_r:type_t:s0").should be_nil
end
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list