Skip to content

Commit

Permalink
Merge pull request thias#33 from inkblot/incremental-update
Browse files Browse the repository at this point in the history
Update RRData incrementally
  • Loading branch information
inkblot committed May 1, 2015
2 parents eb6d3f5 + 827fb1e commit a2fcc87
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions lib/puppet_bind/provider/nsupdate.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ex: syntax=ruby si sw=2 ts=2 et
require 'tempfile'

module PuppetBind
Expand Down Expand Up @@ -27,8 +28,8 @@ def destroy
def flush
return if @properties.empty?
update do |file|
destructo(file)
accio(file)
destructo(file)
end
end

Expand Down Expand Up @@ -58,17 +59,25 @@ def update(&block)
end

def accio(file)
newdata.each do |datum|
rrdata_adds.each do |datum|
file.write "update add #{name}. #{resource[:ttl]} #{rrclass} #{type} #{datum}\n"
end
end

def destructo(file)
rrdata.each do |datum|
rrdata_deletes.each do |datum|
file.write "update delete #{name}. #{ttl} #{rrclass} #{type} #{datum}\n"
end
end

def rrdata_adds
newdata - rrdata
end

def rrdata_deletes
type === 'SOA' ? [] : rrdata - newdata
end

def server
resource[:server]
end
Expand Down

0 comments on commit a2fcc87

Please sign in to comment.