Class Puppet::Property
In: lib/puppet/property/keyvalue.rb
lib/puppet/property/list.rb
lib/puppet/property/ordered_list.rb
lib/puppet/property.rb
lib/puppet/type/zpool.rb
Parent: Object

Methods

Classes and Modules

Class Puppet::Property::Ensure
Class Puppet::Property::KeyValue
Class Puppet::Property::List
Class Puppet::Property::MultiVDev
Class Puppet::Property::OrderedList
Class Puppet::Property::VDev

Attributes

name  [R] 
noop  [W] 
shadow  [R] 
shouldorig  [R]  Because ‘should’ uses an array, we have a special method for handling it. We also want to keep copies of the original values, so that they can be retrieved and compared later when merging.
unmanaged  [RW] 

Public Class methods

Return array matching info, defaulting to just matching the first value.

Set whether properties should match all values or just the first one.

initialize our property

Define a new valid value for a property. You must provide the value itself, usually as a symbol, or a regex to match the value.

The first argument to the method is either the value itself or a regex. The second argument is an option hash; valid options are:

  • :method: The name of the method to define. Defaults to ‘set_<value>’.
  • :required_features: A list of features this value requires.
  • :event: The event that should be returned when this value is set.
  • :call: When to call any associated block. The default value is ``instead``, which means to call the value instead of calling the provider. You can also specify ``before`` or ``after``, which will call both the block and the provider, according to the order you specify (the ``first`` refers to when the block is called, not the provider).

Look up a value‘s name, so we can find options and such.

Retrieve an option set when a value was defined.

Public Instance methods

Call the provider method.

Call the dynamically-created method associated with our value, if there is one.

How should a property change be printed as a string?

Figure out which event to return.

Determine whether the property is in-sync or not. If @should is not defined or is set to a non-true value, then we do not have a valid value for it and thus consider the property to be in-sync since we cannot fix it. Otherwise, we expect our should value to be an array, and if @is matches any of those values, then we consider it to be in-sync.

because the @should and @is vars might be in weird formats, we need to set up a mechanism for pretty printing of the values default to just the values, but this way individual properties can override these methods

Send a log message.

Should we match all values, or just the first?

Execute our shadow‘s munge code, too, if we have one.

each property class must define the name() method, and property instances do not change that name this implicitly means that a given object can only have one property instance of a given property class

for testing whether we should actually do anything

By default, call the method associated with the property name on our provider. In other words, if the property name is ‘gid’, we‘ll call ‘provider.gid’ to retrieve the current value.

Set our value, using the provider, an associated block, or both.

If there‘s a shadowing metaparam, instantiate it now. This allows us to create a property or parameter with the same name as a metaparameter, and the metaparam will only be stored as a shadow.

Only return the first value

Verify that the passed value is valid. If the developer uses a ‘validate’ hook, this method will get overridden.

Make sure that we‘ve got all of the required features for a given value.

Just return any should value we might have.

Match the Parameter interface, but we really just use ‘should’ internally. Note that the should= method does all of the validation and such.

[Validate]