Forge Home

boolean

Boolean normalizing property for Puppet types

306,349 downloads

230,112 latest version

5.0 quality score

Version information

  • 2.0.2 (latest)
  • 2.0.1
  • 2.0.0
  • 1.1.0
released Oct 20th 2018
This version is compatible with:
  • Puppet Enterprise 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x, 2017.3.x, 2017.2.x, 2016.4.x
  • Puppet >= 4.10.0 < 7.0.0
  • , , , ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'puppet-boolean', '2.0.2'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add puppet-boolean
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install puppet-boolean --version 2.0.2

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

puppet/boolean — version 2.0.2 Oct 20th 2018

puppet-boolean

Define actual boolean parameters and properties for puppet types.

Synopsis

Puppet has loosely defined internal types which can make normalizing boolean values in types and providers difficult. This custom parameter and property will handle 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)

  newparam(:more_explosions, :parent => Puppet::Parameter::Boolean) do
    desc "Indicate that more explosions are necessary"
    defaultto true # When it doubt, we want more explosions
  end

  newproperty(:better_than_sliced_bread, :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':
  more_explosions                => 'yes',  # Use yes as a quoted string!
  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