Forge Home

ptlib

Utility functions for puppet module developers

12,804 downloads

12,364 latest version

3.9 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

  • 0.1.2 (latest)
  • 0.1.1
  • 0.1.0
released Aug 27th 2013

Start using this module

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

Add this module to your Puppetfile:

mod 'ptomulik-ptlib', '0.1.2'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add ptomulik-ptlib
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install ptomulik-ptlib --version 0.1.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

ptomulik/ptlib — version 0.1.2 Aug 27th 2013

ptomulik-ptlib

Build Status

Utility functions for puppet modules' developers.

Functions

pt_delete_undef_values

Deletes all instances of the undef value from an array or hash.

Examples:

$hash = pt_delete_undef_values({a=>'A', b=>'', c=>undef, d => false})

Would return: {a => 'A', b => '', d => false}

$array = pt_delete_undef_values(['A','',undef,false])

Would return: ['A','',false]

  • Type: rvalue

pt_delete_values

Deletes all instances of a given value from a hash.

Examples:

pt_delete_values({'a'=>'A','b'=>'B','c'=>'C','B'=>'D'}, 'B')

Would return: {'a'=>'A','c'=>'C','B'=>'D'}

  • Type: rvalue

pt_getparamdefault

Takes a type or resource reference and name of the parameter and returns default value of parameter for that type/resource (or empty string if default is not set).

Examples:

package { 'apache2': provider => apt }
pt_getparamdefault(Package['apache2'], provider)

Would return '' (default provider was not defined).

Package { provider => aptitude }

node example.com {
  package { 'apache2': provider => apt }
  pt_getparamdefault(Package['apache2'], provider)
}

Would return 'aptitude'.

Package { provider => aptitude }

node example.com {
  Package { provider => apt }
  package { 'apache2': }
  pt_getparamdefault(Package['apache2'], provider)
}

Would return 'apt'.

Package { provider => aptitude }

node example.com {
  Package { provider => apt }
  pt_getparamdefault(Package, provider)
}

Would return 'apt'.

pt_getparamdefault(Foo['bar'], geez)

Would not compile (resource Foo[bar] does not exist)

pt_getparamdefault(Foo, geez)

Would not compile (type Foo does not exist)

  • Type: rvalue