Skip to content

Commit

Permalink
Merge pull request thias#42 from inkblot/provider-fixes-41
Browse files Browse the repository at this point in the history
Provider fixes thias#41
  • Loading branch information
inkblot committed May 22, 2015
2 parents 7edd25a + eb58ab9 commit c5f463b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 10 deletions.
31 changes: 25 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,13 @@ values are `IN`, `CH`, and `HS`.

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

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

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

resource_record { 'example.com mail exchangers':
record => 'example.com',
type => 'MX',
data => [ '10 mx', '20 mx2', '20 mx.mail-host.ex.', ],
data => [ '10 mx.example.com.', '20 mx2.example.com.', '20 mx.mail-host.ex.', ],
}

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

resource_record { 'example.com name servers':
record => 'example.com',
type => 'NS',
data => [ 'ns1', 'ns2', 'ns.dns-host.ex.' ],
data => [ 'ns1.example.com.', 'ns2.example.com.', 'ns.dns-host.ex.' ],
}

Delegating nameserver records in a parent zone. Declares a nameserver record in
the parent zone in order to delegate authority for a subdomain:

resource_record { 'sub.example.com delegation':
record => 'sub.example.com'
type => 'NS',
zone => 'example.com',
query_section => 'authority',
data => 'sub-ns.example.com.',
}

Service locators records for a domain. Declares a service locator for SIP over
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/provider/resource_record/nsupdate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def rrclass
end

def type
resource[:type]
resource[:type].to_s
end

def name
Expand Down
6 changes: 3 additions & 3 deletions lib/puppet_bind/provider/nsupdate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def destructo(file)
end

def quoted_type?(type)
%(TXT SPF).include?(type)
%w(TXT SPF).include?(type)
end

def maybe_quote(type, datum)
Expand All @@ -83,11 +83,11 @@ def maybe_unquote(type, datum)
end

def rrdata_adds
newdata - rrdata
resource[:ensure] === :absent ? [] : newdata - rrdata
end

def rrdata_deletes
type === 'SOA' ? [] : rrdata - newdata
resource[:ensure] === :absent ? rrdata : (type === 'SOA' ? [] : rrdata - newdata)
end

def server
Expand Down

0 comments on commit c5f463b

Please sign in to comment.