Merge pull request #34 from backstop/query-sections
Allow response records from other sections
This commit is contained in:
commit
52d4224961
@ -257,6 +257,10 @@ the same nameserver.
|
|||||||
`server` defaults to "localhost" and need not be specified. The value may be
|
`server` defaults to "localhost" and need not be specified. The value may be
|
||||||
either a hostname or IP address.
|
either a hostname or IP address.
|
||||||
|
|
||||||
|
`query_section` indicates the section of the DNS response to check for existing
|
||||||
|
record values. It must be one of `answer`, `authority`, or `additional`.
|
||||||
|
Defaults to: `answer`
|
||||||
|
|
||||||
`keyname` defaults to "update" and need not be specified. This parameter
|
`keyname` defaults to "update" and need not be specified. This parameter
|
||||||
specifies the name of a TSIG key to be used to authenticate the update. The
|
specifies the name of a TSIG key to be used to authenticate the update. The
|
||||||
resource only uses a TSIG key if a `secret` is specified.
|
resource only uses a TSIG key if a `secret` is specified.
|
||||||
|
|||||||
@ -51,6 +51,12 @@ Puppet::Type.newtype(:dns_rr) do
|
|||||||
defaultto 'localhost'
|
defaultto 'localhost'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
newparam(:query_section) do
|
||||||
|
desc 'The DNS response section to check for existing record values'
|
||||||
|
defaultto 'answer'
|
||||||
|
newvalues 'answer', 'authority', 'additional'
|
||||||
|
end
|
||||||
|
|
||||||
newparam(:keyname) do
|
newparam(:keyname) do
|
||||||
desc 'Keyname for the TSIG key used to update the record'
|
desc 'Keyname for the TSIG key used to update the record'
|
||||||
defaultto 'update'
|
defaultto 'update'
|
||||||
|
|||||||
@ -37,6 +37,12 @@ Puppet::Type.newtype(:resource_record) do
|
|||||||
defaultto 'localhost'
|
defaultto 'localhost'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
newparam(:query_section) do
|
||||||
|
desc 'The DNS response section to check for existing record values'
|
||||||
|
defaultto 'answer'
|
||||||
|
newvalues 'answer', 'authority', 'additional'
|
||||||
|
end
|
||||||
|
|
||||||
newparam(:keyname) do
|
newparam(:keyname) do
|
||||||
desc 'Keyname for the TSIG key used to update the record'
|
desc 'Keyname for the TSIG key used to update the record'
|
||||||
defaultto 'update'
|
defaultto 'update'
|
||||||
|
|||||||
@ -86,6 +86,10 @@ module PuppetBind
|
|||||||
resource[:zone]
|
resource[:zone]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def query_section
|
||||||
|
resource[:query_section]
|
||||||
|
end
|
||||||
|
|
||||||
def keyname
|
def keyname
|
||||||
resource[:keyname]
|
resource[:keyname]
|
||||||
end
|
end
|
||||||
@ -109,9 +113,9 @@ module PuppetBind
|
|||||||
def query
|
def query
|
||||||
unless @query
|
unless @query
|
||||||
if keyed?
|
if keyed?
|
||||||
dig_text = dig("@#{server}", '+noall', '+answer', name, type, '-c', rrclass, '-y', tsig_param)
|
dig_text = dig("@#{server}", '+noall', '+nosearch', '+norecurse', "+#{query_section}", name, type, '-c', rrclass, '-y', tsig_param)
|
||||||
else
|
else
|
||||||
dig_text = dig("@#{server}", '+noall', '+answer', name, type, '-c', rrclass)
|
dig_text = dig("@#{server}", '+noall', '+nosearch', '+norecurse', "+#{query_section}", name, type, '-c', rrclass)
|
||||||
end
|
end
|
||||||
@query = dig_text.lines.map do |line|
|
@query = dig_text.lines.map do |line|
|
||||||
linearray = line.chomp.split(/\s+/, 5)
|
linearray = line.chomp.split(/\s+/, 5)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user