class Puppet::SELFileContext

Public Instance Methods

insync?(value) click to toggle source
Calls superclass method Puppet::Property#insync?
   # File lib/puppet/type/file/selcontext.rb
55 def insync?(value)
56   if not selinux_support?
57     debug("SELinux bindings not found. Ignoring parameter.")
58     true
59   elsif not selinux_label_support?(@resource[:path])
60     debug("SELinux not available for this filesystem. Ignoring parameter.")
61     true
62   else
63     super
64   end
65 end
retrieve() click to toggle source
   # File lib/puppet/type/file/selcontext.rb
29 def retrieve
30   return :absent unless @resource.stat
31   context = self.get_selinux_current_context(@resource[:path])
32   is = parse_selinux_context(name, context)
33   if name == :selrange and selinux_support?
34     self.selinux_category_to_label(is)
35   else
36     is
37   end
38 end
retrieve_default_context(property) click to toggle source
   # File lib/puppet/type/file/selcontext.rb
40 def retrieve_default_context(property)
41   if @resource[:selinux_ignore_defaults] == :true
42     return nil
43   end
44 
45   context = self.get_selinux_default_context(@resource[:path], @resource[:ensure])
46   unless context
47     return nil
48   end
49 
50   property_default = self.parse_selinux_context(property, context)
51   self.debug "Found #{property} default '#{property_default}' for #{@resource[:path]}" if not property_default.nil?
52   property_default
53 end
sync() click to toggle source
   # File lib/puppet/type/file/selcontext.rb
79 def sync
80   self.set_selinux_context(@resource[:path], @should, name)
81   :file_changed
82 end
unsafe_munge(should) click to toggle source
   # File lib/puppet/type/file/selcontext.rb
67 def unsafe_munge(should)
68   if not selinux_support?
69     return should
70   end
71 
72   if name == :selrange
73     self.selinux_category_to_label(should)
74   else
75     should
76   end
77 end