Git Product home page Git Product logo

puppet-boolean's Introduction

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 neccessary"
    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

puppet-boolean's People

Contributors

adrienthebo avatar nanliu avatar trlinkin avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.