Forge Home

diverse_functions

The module contains various functions like validate_platform()

12,698 downloads

12,698 latest version

4.6 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.

Support the Puppet Community by contributing to this module

You are welcome to contribute to this module by suggesting new features, currency updates, or fixes. Every contribution is valuable to help ensure that the module remains compatible with the latest Puppet versions and continues to meet community needs. Complete the following steps:

  1. Review the module’s contribution guidelines and any licenses. Ensure that your planned contribution aligns with the author’s standards and any legal requirements.
  2. Fork the repository on GitHub, make changes on a branch of your fork, and submit a pull request. The pull request must clearly document your proposed change.

For questions about updating the module, contact the module’s author.

Version information

  • 0.1.1 (latest)
released Feb 12th 2015
This version is compatible with:
  • ,

Start using this module

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

Add this module to your Puppetfile:

mod 'gajdaw-diverse_functions', '0.1.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add gajdaw-diverse_functions
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install gajdaw-diverse_functions --version 0.1.1

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

gajdaw/diverse_functions — version 0.1.1 Feb 12th 2015

Puppet Module

gajdaw/diverse_functions

Table of Contents

  1. Overview
  2. Setup
  3. Usage

1. Overview

The module contains the following functions:

validate_platform()

2. Setup

To install the module run:

sudo puppet install module gajdaw-diverse_functions

3. Usage

3.1. validate_platform() function

This function validates if the operating system on the machine that runs manifest matches one of the entires in operatingsystem_support section in metadata.json of the module.

Function needs one parameter: the name of the module to validate.

If the platform returned by the two shell commands:

$ facter operatingsystem
$ facter operatingsystemrelease

can be found in metadata.json then validate_platform() returns true. Otherwise it returns false.

You can use it to automatically validate your module against the current platform. Thus operatingsystem_support section in metadata.json file of your module is the only place where you have to update the information about supported platform.

To validate the platform inside a class defined in a module call the function like in the following snippet:

class abc {

    if !validate_platform($module_name) {
        fail("Platform not supported in module '${module_name}'.")
    }

}

On some platforms, e.g. CentOS, the command:

$ facter operatingsystemrelease

prints full version, like:

7.0.1406

You don't have to use the complete result. You can use arbitrary number of leading characters. The definition:

{
    "operatingsystem": "CentOS",
    "operatingsystemrelease": [
        "7.0"
    ]
}

will be successfully validated on all of the following platforms:

  • CentOS 7.0
  • CentOS 7.0.1406
  • CentOS 7.0.1964-p23
  • CentOS 7.0-dev
  • CentOS 7.0abcdefghijklm

Limitations

You will find the exact information about supported platforms in metadata.json file.