summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-06-10 19:13:16 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2023-06-10 19:13:16 +0200
commitd5981ec98b2541c27a0eea3745661a829b7613da (patch)
tree8bb485da4bea15b4a29085ce604394d0bb62ddf5
parentChanges to included file now notify the service. (diff)
downloaddns-d5981ec98b2541c27a0eea3745661a829b7613da.tar.gz
dns-d5981ec98b2541c27a0eea3745661a829b7613da.tar.xz
Qualify CNAMEs.
-rw-r--r--lib/puppet/provider/dns_record2/named.rb2
-rw-r--r--manifests/record.pp11
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/puppet/provider/dns_record2/named.rb b/lib/puppet/provider/dns_record2/named.rb
index 2060c62..570b6f1 100644
--- a/lib/puppet/provider/dns_record2/named.rb
+++ b/lib/puppet/provider/dns_record2/named.rb
@@ -4,7 +4,7 @@ Puppet::Type.type(:dns_record2).provide(:named) do
end
def exists?
- record != nil
+ record != []
end
def type
diff --git a/manifests/record.pp b/manifests/record.pp
index c8b0baa..d25bb85 100644
--- a/manifests/record.pp
+++ b/manifests/record.pp
@@ -33,7 +33,7 @@
define dns::record (
Dns::Zonename $zone,
Dns::Rr $type,
- String $value,
+ String[1] $value,
Dns::Class $cls = 'IN',
String $key = '@',
Optional[Dns::Ttl] $ttl = undef,
@@ -54,6 +54,15 @@ define dns::record (
'TXT': {
$value.slice(255).map |$x| { "\"${x.join()}\"" }.join(' ')
}
+ 'CNAME': {
+ # Qualify CNAMEs. This is when checking if the record already
+ # exists.
+ if $value[-1] == '.' {
+ $value
+ } else {
+ "${value}.${zone}"
+ }
+ }
default: {
$value
}