Puppet Function: unbound::flatten_record
- Defined in:
- functions/flatten_record.pp
- Function type:
- Puppet Language
Overview
Flatten a record type to its string form.
The string will include surrounding quotes as these differ depending on the record type.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'functions/flatten_record.pp', line 14
function unbound::flatten_record(Unbound::Record $value) {
$header = delete_undef_values($value['name', 'ttl', 'class', 'type'])
$record = $value['type'] ? {
'A' => join($header + $value['ip'], ' '),
'AAAA' => join($header + $value['ip'], ' '),
'MX' => join($header + $value['priority', 'hostname'], ' '),
'NS' => join($header + $value['hostname'], ' '),
'PTR' => join($header + $value['hostname'], ' '),
'SOA' => join($header + $value['primary', 'email', 'serial', 'refresh', 'retry', 'expire', 'negative'], ' '),
'TXT' => join($header + "\"${value['value']}\"", ' '),
default => fail("Unsupported type '${value['type']}'"),
}
# Do this separately so lint doesn't explode
$value['type'] ? {
'TXT' => "'${record}'",
default => "\"${record}\"",
}
}
|