Class: Puppet::SELFileContext

Inherits:
Property show all
Includes:
Util::SELinux
Defined in:
lib/puppet/type/file/selcontext.rb

Instance Attribute Summary

Attributes inherited from Property

#noop, #shadow, #shouldorig

Attributes inherited from Parameter

#parent, #resource

Attributes included from Util::Docs

#doc, #nodoc

Attributes included from Util::Cacher::Expirer

#timestamp

Instance Method Summary collapse

Methods included from Util::SELinux

#find_fs, #get_selinux_current_context, #get_selinux_default_context, #parent_directory, #parse_selinux_context, #read_mounts, #realpath, #selinux_label_support?, #selinux_support?, #set_selinux_context, #set_selinux_default_context

Methods inherited from Property

array_matching, array_matching=, #call_provider, #call_valuemethod, #change_to_s, #event, #event_name, #initialize, #is_to_s, #log, #match_all?, method_added, #munge, #name, newvalue, #safe_insync?, #set, #setup_shadow, #should, #should=, #should_to_s, #unsafe_validate, #validate_features_per_value, #value, #value=, value_name, value_option

Methods inherited from Parameter

aliasvalue, defaultto, desc, #devfail, doc, #expirer, #fail, #initialize, initvars, isnamevar, isnamevar?, isrequired, #log, #metaparam?, #munge, munge, #name, newvalues, nodefault, #noop, #pathbuilder, #provider, proxymethods, #remove, required?, #tags, #to_s, unmunge, #unmunge, #unsafe_munge, #unsafe_validate, validate, #validate, #value, #value=

Methods included from Util::Docs

#desc, #dochook, #doctable, #nodoc?, #pad, scrub

Methods included from Util

activerecord_version, benchmark, chuser, classproxy, #execfail, #execpipe, execute, logmethods, memory, proxy, recmkdir, secure_open, symbolize, symbolizehash, symbolizehash!, synchronize_on, thinmark, #threadlock, which, withumask

Methods included from Util::POSIX

#get_posix_field, #gid, #idfield, #methodbyid, #methodbyname, #search_posix_field, #uid

Methods included from Util::Cacher

extended, included

Methods included from Util::Cacher::Expirer

#dependent_data_expired?, #expire

Methods included from Util::MethodHelper

#requiredopts, #set_options, #symbolize_options

Methods included from Util::Logging

#send_log

Methods included from Util::LogPaths

#path, #source_descriptors

Methods included from Util::Errors

#adderrorcontext, #devfail, #error_context, #exceptwrap, #fail

Constructor Details

This class inherits a constructor from Puppet::Property

Instance Method Details

#insync?(value) ⇒ Boolean

Returns:

  • (Boolean)


48
49
50
51
52
53
54
# File 'lib/puppet/type/file/selcontext.rb', line 48

def insync?(value)
  if not selinux_support?
    debug("SELinux bindings not found. Ignoring parameter.")
    return true
  end
  super
end

#retrieveObject



28
29
30
31
32
# File 'lib/puppet/type/file/selcontext.rb', line 28

def retrieve
  return :absent unless @resource.stat(false)
  context = self.get_selinux_current_context(@resource[:path])
  parse_selinux_context(name, context)
end

#retrieve_default_context(property) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/puppet/type/file/selcontext.rb', line 34

def retrieve_default_context(property)
  if @resource[:selinux_ignore_defaults] == :true
    return nil
  end

  unless context = self.get_selinux_default_context(@resource[:path])
    return nil
  end

  property_default = self.parse_selinux_context(property, context)
  self.debug "Found #{property} default '#{property_default}' for #{@resource[:path]}" if not property_default.nil?
  property_default
end

#syncObject



56
57
58
59
# File 'lib/puppet/type/file/selcontext.rb', line 56

def sync
  self.set_selinux_context(@resource[:path], @should, name)
  :file_changed
end