diff options
-rw-r--r-- | lib/puppet/type/file/selcontext.rb | 7 | ||||
-rw-r--r-- | spec/unit/other/selinux.rb | 6 |
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 |