summaryrefslogtreecommitdiff
path: root/manifests/record.pp
diff options
context:
space:
mode:
Diffstat (limited to 'manifests/record.pp')
-rw-r--r--manifests/record.pp32
1 files changed, 23 insertions, 9 deletions
diff --git a/manifests/record.pp b/manifests/record.pp
index 83476a0..2ecb52f 100644
--- a/manifests/record.pp
+++ b/manifests/record.pp
@@ -11,23 +11,29 @@
# Allow multiple records with the same name and class.
# Most record types only allow one value, but some allow multiple.
# Setting this to true allows for multiple. This value is
-# automatically true for TXT & NS.
+# automatically true for TXT, MX & NS.
# @param zone
# Name of the zone this record belongs to.
# @param value
# Record content.
# Syntax depends on `type`.
+# Some record types have extra processing.
+# TXT splits data into chunks of 255 characters (TODO shouldn't
+# this be bytes) and the surrounds each chunk with quotation marks.
define dns::record (
String $zone,
Dns::Rr $type,
String $value,
- Dns::Class $class = 'IN',
- String $dns_name = $name,
+ Dns::Class $cls = 'IN',
+ String $key = $name,
Optional[Dns::Ttl] $ttl = undef,
Boolean $duplicate = false,
) {
+ $zone_ = dns::ensure_ending_period($zone)
+
$allow_duplicate = case $type {
'TXT',
+ 'MX',
'NS': {
true
}
@@ -36,13 +42,21 @@ define dns::record (
}
}
- $frag_name = if $allow_duplicate {
- "Dns::Record - ${zone} - ${class} ${type} ${dns_name} ${value}"
- } else {
- "Dns::Record - ${zone} - ${class} ${type} ${dns_name}"
+ $value_ = case $type {
+ 'TXT': {
+ $value.slice(255).map |$x| { "\"${x.join()}\"" }.join(' ')
+ }
+ default: {
+ $value
+ }
}
- concat::fragment { $frag_name:
- target => "${dns::zone_directory}/${zone}.db",
+ dns_record2 { $name:
+ type => $type,
+ value => $value_,
+ cls => $cls,
+ zone => $zone,
+ ttl => $ttl,
+ key => $key,
}
}