Skip to content

Commit c5f463b

Browse files
committed
Merge pull request thias#42 from inkblot/provider-fixes-41
Provider fixes thias#41
2 parents 7edd25a + eb58ab9 commit c5f463b

File tree

3 files changed

+29
-10
lines changed

3 files changed

+29
-10
lines changed

README.md

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,13 @@ values are `IN`, `CH`, and `HS`.
253253

254254
`data` is required, and may be a scalar value or an array of scalar values
255255
whose format conform to the type of DNS resource record being created. `data`
256-
is an ensurable property and changes will be reflected in DNS.
256+
is an ensurable property and changes will be reflected in DNS. **Note**: for
257+
record types that have a DNS name as either the whole value or a component of
258+
the value (e.g. `NS`, 'MX', `CNAME`, `PTR`, `NAPTR`, or `SRV`) you must specify
259+
the name as a fully-qualified name with a trailing dot in order to satisfy
260+
both BIND, which will otherwise consider it a name relative, and Puppet, which
261+
will not consider the dot-qualified output of dig equal to a non-dot-qualified
262+
value in the manifest.
257263

258264
`ttl` defaults to 43200 and need not be specified. `ttl` is an ensurable
259265
property and changes will be reflected in DNS.
@@ -285,22 +291,35 @@ specified, then the update will not use TSIG authentication.
285291
####resource_record examples
286292

287293
Mail exchangers for a domain. Declares three mail exchangers for the domain
288-
`example.com`, which are `mx.example.com`, `mx2.example.com`, and `mx.mail-host.ex`
289-
with priorities `10`, `20`, and `30`, respectively:
294+
`example.com`, which are `mx.example.com`, `mx2.example.com`, and
295+
`mx.mail-host.ex` with priorities `10`, `20`, and `30`, respectively (note the
296+
trailing dots in the values to denote fully-qualified names):
290297

291298
resource_record { 'example.com mail exchangers':
292299
record => 'example.com',
293300
type => 'MX',
294-
data => [ '10 mx', '20 mx2', '20 mx.mail-host.ex.', ],
301+
data => [ '10 mx.example.com.', '20 mx2.example.com.', '20 mx.mail-host.ex.', ],
295302
}
296303

297304
Nameserver records for a zone. Declares three nameserver records for the zone
298-
`example.com`, which are `ns1.example.com`, `ns2.example.com`, and `ns.dns-host.ex`:
305+
`example.com`, which are `ns1.example.com`, `ns2.example.com`, and
306+
`ns.dns-host.ex`:
299307

300308
resource_record { 'example.com name servers':
301309
record => 'example.com',
302310
type => 'NS',
303-
data => [ 'ns1', 'ns2', 'ns.dns-host.ex.' ],
311+
data => [ 'ns1.example.com.', 'ns2.example.com.', 'ns.dns-host.ex.' ],
312+
}
313+
314+
Delegating nameserver records in a parent zone. Declares a nameserver record in
315+
the parent zone in order to delegate authority for a subdomain:
316+
317+
resource_record { 'sub.example.com delegation':
318+
record => 'sub.example.com'
319+
type => 'NS',
320+
zone => 'example.com',
321+
query_section => 'authority',
322+
data => 'sub-ns.example.com.',
304323
}
305324

306325
Service locators records for a domain. Declares a service locator for SIP over

lib/puppet/provider/resource_record/nsupdate.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def rrclass
3434
end
3535

3636
def type
37-
resource[:type]
37+
resource[:type].to_s
3838
end
3939

4040
def name

lib/puppet_bind/provider/nsupdate.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def destructo(file)
7171
end
7272

7373
def quoted_type?(type)
74-
%(TXT SPF).include?(type)
74+
%w(TXT SPF).include?(type)
7575
end
7676

7777
def maybe_quote(type, datum)
@@ -83,11 +83,11 @@ def maybe_unquote(type, datum)
8383
end
8484

8585
def rrdata_adds
86-
newdata - rrdata
86+
resource[:ensure] === :absent ? [] : newdata - rrdata
8787
end
8888

8989
def rrdata_deletes
90-
type === 'SOA' ? [] : rrdata - newdata
90+
resource[:ensure] === :absent ? rrdata : (type === 'SOA' ? [] : rrdata - newdata)
9191
end
9292

9393
def server

0 commit comments

Comments
 (0)