Forge Home

boolean

Boolean normalizing property for Puppet types

2,081,652 downloads

2,038,588 latest version

4.1 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 1.0.1 (latest)
  • 1.0.0
  • 0.9.0
  • 0.9.0-rc1 (pre-release)
released Aug 14th 2013
This module has been deprecated by its author since Jun 26th 2023.

The author has suggested puppet-boolean as its replacement.

Start using this module

Documentation

adrien/boolean — version 1.0.1 Aug 14th 2013

puppet-boolean

Define actual boolean properties for puppet types.

Synopsis

Puppet has loosely defined internal types which can make normalizing boolean values in types and providers difficult. This custom property handles that normalization in one place by defining actual boolean states.

Example

Type implementation:

require 'puppet/property/boolean'

Puppet::Type.newtype(:awesome) do

  newparam(:name, :namevar => true)

  newproperty(:betterthanslicedbread, :parent => Puppet::Property::Boolean) do
    desc "Determine if the thing is more awesome than sliced bread"
    defaultto true # It's not hard to be more awesome than sliced bread
  end

  newproperty(:better_than_rocket_boots, :parent => Puppet::Property::Boolean) do
    desc "Determine if the thing is more often than rocket boots"
    defaultto false # Rocket boots are pretty hard to beat
  end

  newproperty(:will_get_you_eaten_by_sharks, :parent => Puppet::Property::Boolean) do
    desc "Determine if this is so awesome that it'll get you eaten by sharks"
    defaultto :false # Use a symbol for the default value and it'll still be false
  end

  newproperty(:suitable_for_human_consumption, :parent => Puppet::Property::Boolean) do
    desc "Determine if the thing is both awesome and edible"
    defaultto :false # The are more non-edible things than edible things
  end
end

Type usage:

awesome { 'actual booleans':
  better_than_rocket_boots       => true,   # Use an unquoted string!
  better_than_sliced_bread       => 'true', # Use a quoted string!
  suitable_for_human_consumption => no,     # Use yes and no! It doesn't matter!
}

Contact

If you have questions or concerns about this module, contact finch on #puppet on Freenode, or email adrien@puppetlabs.com.