Class: Puppet::Property::List
- Inherits:
-
Puppet::Property
- Object
- Puppet::Parameter
- Puppet::Property
- Puppet::Property::List
- Defined in:
- lib/puppet/property/list.rb
Overview
This subclass of Puppet::Property manages an unordered list of values. For an ordered list see OrderedList.
Direct Known Subclasses
Constant Summary
Constants included from Util::Docs
Constants included from Util
Util::AbsolutePathPosix, Util::AbsolutePathWindows, Util::DEFAULT_POSIX_MODE, Util::DEFAULT_WINDOWS_MODE
Constants included from Util::POSIX
Util::POSIX::LOCALE_ENV_VARS, Util::POSIX::USER_ENV_VARS
Constants included from Util::SymbolicFileMode
Util::SymbolicFileMode::SetGIDBit, Util::SymbolicFileMode::SetUIDBit, Util::SymbolicFileMode::StickyBit, Util::SymbolicFileMode::SymbolicMode, Util::SymbolicFileMode::SymbolicSpecialToBit
Constants included from Util::Logging
Util::Logging::FILE_AND_LINE, Util::Logging::FILE_NO_LINE, Util::Logging::MM, Util::Logging::NO_FILE_LINE
Instance Attribute Summary
Attributes inherited from Puppet::Property
Attributes inherited from Puppet::Parameter
Attributes included from Util::Docs
Instance Method Summary collapse
- #add_should_with_current(should, current) ⇒ Object
-
#dearrayify(array) ⇒ Object
dearrayify was motivated because to simplify the implementation of the OrderedList property.
- #delimiter ⇒ Object
- #inclusive? ⇒ Boolean
- #insync?(is) ⇒ Boolean
- #is_to_s(currentvalue) ⇒ Object
- #membership ⇒ Object
- #prepare_is_for_comparison(is) ⇒ Object
- #retrieve ⇒ Object
- #should ⇒ Object
- #should_to_s(should_value) ⇒ Object
Methods inherited from Puppet::Property
#call_provider, #change_to_s, #event, #event_name, #log, #match_all?, method_added, #name, newvalue, #property_matches?, #safe_insync?, #set, #should=, #sync, #unsafe_validate, #validate_features_per_value, #value, #value=, value_name, value_option
Methods inherited from Puppet::Parameter
aliasvalue, defaultto, desc, doc, #file, format_value_for_display, #initialize, initvars, isnamevar, isnamevar?, #isnamevar?, isrequired, #line, #log, #metaparam?, #munge, munge, newvalues, nodefault, #noop, #path, #pathbuilder, #provider, proxymethods, #remove, #required?, required?, #tags, #to_s, unmunge, #unmunge, #unsafe_munge, #unsafe_validate, validate, #validate, #value, #value=, #version
Methods included from Util::Docs
#desc, #dochook, #doctable, #markdown_definitionlist, #markdown_header, #nodoc?, #pad, scrub
Methods included from Util
absolute_path?, benchmark, chuser, clear_environment, default_env, deterministic_rand, deterministic_rand_int, exit_on_fail, get_env, get_environment, logmethods, merge_environment, path_to_uri, pretty_backtrace, replace_file, safe_posix_fork, set_env, symbolizehash, thinmark, uri_to_path, which, withenv, withumask
Methods included from Util::POSIX
#get_posix_field, #gid, #idfield, #methodbyid, #methodbyname, #search_posix_field, #uid
Methods included from Util::SymbolicFileMode
#normalize_symbolic_mode, #symbolic_mode_to_int, #valid_symbolic_mode?
Methods included from Util::MethodHelper
#requiredopts, #set_options, #symbolize_options
Methods included from Util::Logging
#clear_deprecation_warnings, #debug, #deprecation_warning, #format_exception, #get_deprecation_offender, #log_and_raise, #log_deprecations_to_file, #log_exception, #puppet_deprecation_warning, #send_log, setup_facter_logging!, #warn_once
Methods included from Util::Errors
#adderrorcontext, #devfail, #error_context, #exceptwrap, #fail
Constructor Details
This class inherits a constructor from Puppet::Parameter
Instance Method Details
#add_should_with_current(should, current) ⇒ Object
27 28 29 30 |
# File 'lib/puppet/property/list.rb', line 27 def add_should_with_current(should, current) should += current if current.is_a?(Array) should.uniq end |
#dearrayify(array) ⇒ Object
dearrayify was motivated because to simplify the implementation of the OrderedList property
37 38 39 |
# File 'lib/puppet/property/list.rb', line 37 def dearrayify(array) array.sort.join(delimiter) end |
#inclusive? ⇒ Boolean
32 33 34 |
# File 'lib/puppet/property/list.rb', line 32 def inclusive? @resource[membership] == :inclusive end |
#insync?(is) ⇒ Boolean
71 72 73 74 75 |
# File 'lib/puppet/property/list.rb', line 71 def insync?(is) return true unless is (prepare_is_for_comparison(is) == self.should) end |
#is_to_s(currentvalue) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/puppet/property/list.rb', line 15 def is_to_s(currentvalue) if currentvalue == :absent return "absent" else return currentvalue.join(delimiter) end end |
#membership ⇒ Object
23 24 25 |
# File 'lib/puppet/property/list.rb', line 23 def membership :membership end |
#prepare_is_for_comparison(is) ⇒ Object
64 65 66 67 68 69 |
# File 'lib/puppet/property/list.rb', line 64 def prepare_is_for_comparison(is) if is == :absent is = [] end dearrayify(is) end |
#retrieve ⇒ Object
55 56 57 58 59 60 61 62 |
# File 'lib/puppet/property/list.rb', line 55 def retrieve #ok, some 'convention' if the list property is named groups, provider should implement a groups method if provider and tmp = provider.send(name) and tmp != :absent return tmp.split(delimiter) else return :absent end end |
#should ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/puppet/property/list.rb', line 41 def should return nil unless @should members = @should #inclusive means we are managing everything so if it isn't in should, its gone members = add_should_with_current(members, retrieve) if ! inclusive? dearrayify(members) end |
#should_to_s(should_value) ⇒ Object
10 11 12 13 |
# File 'lib/puppet/property/list.rb', line 10 def should_to_s(should_value) #just return the should value should_value end |