Class: Puppet::Property::List
- Inherits:
-
Puppet::Property
- Object
- Puppet::Parameter
- Puppet::Property
- Puppet::Property::List
- Defined in:
- lib/vendor/puppet/property/list.rb
Direct Known Subclasses
Constant Summary
Constants included from Util::Docs
Constants included from Util
Util::AbsolutePathPosix, Util::AbsolutePathWindows
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
array_matching, array_matching=, #call_provider, #call_valuemethod, #change_to_s, #event, #event_name, #initialize, #log, #match_all?, method_added, #munge, #name, newvalue, #property_matches?, #safe_insync?, #set, #setup_shadow, #should=, #sync, #unsafe_validate, #validate_features_per_value, #value, #value=, value_name, value_option
Methods inherited from Puppet::Parameter
aliasvalue, defaultto, desc, #devfail, doc, #fail, format_value_for_display, #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, #markdown_definitionlist, #markdown_header, #nodoc?, #pad, scrub
Methods included from Util
absolute_path?, activerecord_version, benchmark, binread, chuser, classproxy, #execfail, #execpipe, execute, execute_posix, execute_windows, logmethods, memory, path_to_uri, proxy, replace_file, safe_posix_fork, symbolize, symbolizehash, symbolizehash!, synchronize_on, thinmark, #threadlock, uri_to_path, wait_for_output, which, withumask
Methods included from Util::POSIX
#get_posix_field, #gid, #idfield, #methodbyid, #methodbyname, #search_posix_field, #uid
Methods included from Util::MethodHelper
#requiredopts, #set_options, #symbolize_options
Methods included from Util::Logging
#clear_deprecation_warnings, #deprecation_warning, #send_log
Methods included from Util::LogPaths
Methods included from Util::Errors
#adderrorcontext, #devfail, #error_context, #exceptwrap, #fail
Constructor Details
This class inherits a constructor from Puppet::Property
Instance Method Details
#add_should_with_current(should, current) ⇒ Object
24 25 26 27 |
# File 'lib/vendor/puppet/property/list.rb', line 24 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
34 35 36 |
# File 'lib/vendor/puppet/property/list.rb', line 34 def dearrayify(array) array.sort.join(delimiter) end |
#delimiter ⇒ Object
48 49 50 |
# File 'lib/vendor/puppet/property/list.rb', line 48 def delimiter "," end |
#inclusive? ⇒ Boolean
29 30 31 |
# File 'lib/vendor/puppet/property/list.rb', line 29 def inclusive? @resource[membership] == :inclusive end |
#insync?(is) ⇒ Boolean
68 69 70 71 72 |
# File 'lib/vendor/puppet/property/list.rb', line 68 def insync?(is) return true unless is (prepare_is_for_comparison(is) == self.should) end |
#is_to_s(currentvalue) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/vendor/puppet/property/list.rb', line 12 def is_to_s(currentvalue) if currentvalue == :absent return "absent" else return currentvalue.join(delimiter) end end |
#membership ⇒ Object
20 21 22 |
# File 'lib/vendor/puppet/property/list.rb', line 20 def membership :membership end |
#prepare_is_for_comparison(is) ⇒ Object
61 62 63 64 65 66 |
# File 'lib/vendor/puppet/property/list.rb', line 61 def prepare_is_for_comparison(is) if is == :absent is = [] end dearrayify(is) end |
#retrieve ⇒ Object
52 53 54 55 56 57 58 59 |
# File 'lib/vendor/puppet/property/list.rb', line 52 def retrieve #ok, some 'convention' if the list property is named groups, provider should implement a groups method if tmp = provider.send(name) and tmp != :absent return tmp.split(delimiter) else return :absent end end |
#should ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'lib/vendor/puppet/property/list.rb', line 38 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
7 8 9 10 |
# File 'lib/vendor/puppet/property/list.rb', line 7 def should_to_s(should_value) #just return the should value should_value end |