Puppet Function: deferlib::unless_cmd

Defined in:
functions/unless_cmd.pp
Function type:
Puppet Language

Summary

returns value if deferred shell command execution exit code not 0 else returns options[else]

Overview

deferlib::unless_cmd(String $cmd, Any $value, Optional[Hash] $options = {})Any

Examples:

ensure cron service running unless command /bin/ismaintenance returns 0

service { 'cron':
  ensure => deferlib::unless_cmd('/bin/ismaintenance', 'running'),
}

Parameters:

  • cmd (String)

    shell code to execute

  • value (Any)

    value to return if command exit code is not 0

  • options (Optional[Hash]) (defaults to: {})

    shell execution options

Options Hash (options):

  • 'else' (Any)

    returned value if command exit code is 0, default []

  • 'user' (Variant[String,Integer])

    The user to run the command as

  • 'group' (Variant[String,Integer])

    The group to run the command as

  • 'environment' (Hash)

    Hash of environment variable names / variable values

Returns:

Author:

  • Franck Jouvanceau



26
27
28
29
30
31
32
# File 'functions/unless_cmd.pp', line 26

function deferlib::unless_cmd (
  String         $cmd,
  Any            $value,
  Optional[Hash] $options = {},
) {
  Deferred('deferlib::unless_cmd_', [$cmd, $value, $options])
}