Class: Puppet::IniProperty
- Defined in:
- lib/vendor/puppet/type/yumrepo.rb
Overview
A property for one entry in a .ini-style file
Constant Summary
Constants included from Util::Docs
Constants included from Util
Util::AbsolutePathPosix, Util::AbsolutePathWindows
Instance Attribute Summary
Attributes inherited from Property
Attributes inherited from Parameter
Attributes included from Util::Docs
Class Method Summary collapse
-
.inikey(key) ⇒ Object
Set the key associated with this property to KEY, instead of using the property’s NAME.
Instance Method Summary collapse
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, #property_matches?, #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, #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
Class Method Details
.inikey(key) ⇒ Object
Set the key associated with this property to KEY, instead of using the property’s NAME
40 41 42 43 44 45 46 |
# File 'lib/vendor/puppet/type/yumrepo.rb', line 40 def self.inikey(key) # Override the inikey instance method # Is there a way to do this without resorting to strings ? # Using a block fails because the block can't access # the variable 'key' in the outer scope self.class_eval("def inikey ; \"#{key.to_s}\" ; end") end |
Instance Method Details
#inikey ⇒ Object
34 35 36 |
# File 'lib/vendor/puppet/type/yumrepo.rb', line 34 def inikey name.to_s end |
#insync?(is) ⇒ Boolean
8 9 10 11 12 13 14 |
# File 'lib/vendor/puppet/type/yumrepo.rb', line 8 def insync?(is) # A should property of :absent is the same as nil if is.nil? && should == :absent return true end super(is) end |
#retrieve ⇒ Object
30 31 32 |
# File 'lib/vendor/puppet/type/yumrepo.rb', line 30 def retrieve resource.section[inikey] end |
#sync ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/vendor/puppet/type/yumrepo.rb', line 16 def sync if safe_insync?(retrieve) result = nil else result = set(self.should) if should == :absent resource.section[inikey] = nil else resource.section[inikey] = should end end result end |