Method: Puppet::Type.ensurable
- Defined in:
- lib/puppet/type.rb
.ensurable ⇒ void .ensurable({ ... }) ⇒ void
This method will be automatically called without a block if the type implements the methods specified by ensurable?. It is recommended to always call this method and not rely on this automatic specification to clearly state that the type is ensurable.
This method returns an undefined value.
Creates a new ‘ensure` property with configured default values or with configuration by an optional block. This method is a convenience method for creating a property `ensure` with default accepted values. If no block is specified, the new `ensure` property will accept the default symbolic values `:present`, and `:absent` - see Property::Ensure. If something else is wanted, pass a block and make calls to Property.newvalue from this block to define each possible value. If a block is passed, the defaults are not automatically added to the set of valid values.
194 195 196 197 198 199 200 201 202 |
# File 'lib/puppet/type.rb', line 194 def self.ensurable(&block) if block_given? newproperty(:ensure, :parent => Puppet::Property::Ensure, &block) else newproperty(:ensure, :parent => Puppet::Property::Ensure) do defaultvalues end end end |