summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean E. Millichamp <sean@bruenor.org>2008-09-30 14:38:21 -0400
committerJames Turnbull <james@lovedthanlost.net>2008-10-03 14:33:33 +1000
commit250239eb7fa93dbacd2e755307a6c115615fe87b (patch)
tree1c8d4de67b46ea73e9a27932d5e8a033992fe1f4
parentc8314821a2bd0f1bb60397492735d3775836416f (diff)
downloadpuppet-250239eb7fa93dbacd2e755307a6c115615fe87b.tar.gz
puppet-250239eb7fa93dbacd2e755307a6c115615fe87b.tar.xz
puppet-250239eb7fa93dbacd2e755307a6c115615fe87b.zip
Add new support for :selrange SELinux file property
-rw-r--r--lib/puppet/type/file/selcontext.rb7
-rw-r--r--spec/unit/other/selinux.rb6
2 files changed, 12 insertions, 1 deletions
diff --git a/lib/puppet/type/file/selcontext.rb b/lib/puppet/type/file/selcontext.rb
index a344f20ac..b2c89e6f8 100644
--- a/lib/puppet/type/file/selcontext.rb
+++ b/lib/puppet/type/file/selcontext.rb
@@ -76,5 +76,12 @@ module Puppet
defaultto { self.retrieve_default_context(:seltype) }
end
+ Puppet.type(:file).newproperty(:selrange, :parent => Puppet::SELFileContext) do
+ desc "What the SELinux Range context of the file should be."
+
+ @event = :file_changed
+ defaultto { self.retrieve_default_context(:selrange) }
+ end
+
end
diff --git a/spec/unit/other/selinux.rb b/spec/unit/other/selinux.rb
index 465fc4ea0..26cd84021 100644
--- a/spec/unit/other/selinux.rb
+++ b/spec/unit/other/selinux.rb
@@ -12,7 +12,8 @@ describe Puppet.type(:file), " when manipulating file contexts" do
:ensure => "file",
:seluser => "user_u",
:selrole => "role_r",
- :seltype => "type_t" )
+ :seltype => "type_t",
+ :selrange => "s0" )
end
it "should use :seluser to get/set an SELinux user file context attribute" do
@file.property(:seluser).should == "user_u"
@@ -23,6 +24,9 @@ describe Puppet.type(:file), " when manipulating file contexts" do
it "should use :seltype to get/set an SELinux user file context attribute" do
@file.property(:seltype).should == "type_t"
end
+ it "should use :selrange to get/set an SELinux range file context attribute" do
+ @file.property(:seltype).should == "s0"
+ end
after :each do
Puppet::Type::File.clear()
end