Puppet Function: sap::sysctl_line
- Defined in:
- functions/sysctl_line.pp
- Function type:
- Puppet Language
Summary
This function converts a sysctl entry hash into a string line.Overview
This function converts a given entry from a module specific hash provided to sap::params::config_sysctl into a line of the form <directive> = <value>. There are three supported line types for this component:
-
‘value` - Simply sets the value equal to the entry name
-
‘calculated` - Computes the value via the following formula `base * multiplier / divisor`
-
‘compound` - Performs a recursive call converting multiple value/calculated sub entries into a single space separated value.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'functions/sysctl_line.pp', line 22
function sap::sysctl_line(
String $param,
Hash[
String,
Variant[
String,
Integer,
Array[
Variant[
String,
Hash[
String,
Variant[
Integer,
String,
]
]
]
]
]
] $data
) >> String {
$func_name = 'sap::sysctl_line'
# Determine the entry type
if 'calc_type' in $data {
$calc_type = $data['calc_type']
} else {
fail("${func_name}: '${param}' missing 'calc_type' entry!")
}
case $calc_type {
'compound': {
if 'content' in $data {
$value = sap::sysctl_calculated_values($data['content'], 0)
} else {
fail("${func_name}: '${param}' 'compound' calc_type must specify 'content'!")
}
}
'value': {
$value = sap::sysctl_calculated_values([$data], 0)
}
'calculated': {
$value = sap::sysctl_calculated_values([$data], 0)
}
default: {
fail("${func_name}: '${param}' invalid 'calc_type' '${calc_type}'!")
}
}
$line = "${param} =${value}"
}
|