Skip to content

Instantly share code, notes, and snippets.

@hannesfostie
Last active September 8, 2015 07:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hannesfostie/f38b34b3eafc38204d06 to your computer and use it in GitHub Desktop.
Save hannesfostie/f38b34b3eafc38204d06 to your computer and use it in GitHub Desktop.
def self.perform fqdn
tries ||= 3
output = Open3.capture2e("sudo pdnssec rectify-zone '#{fqdn}'")[0].strip
case output
when 'Adding NSEC ordering information'
# Not an error, doing nothing
when "No SOA known for '#{fqdn}', is such a zone in the database?"
if (tries -= 1) > 0
sleep 1000
retry
else
raise PowerDNSNoSOAFoundError
end
else
raise PowerDNSRectifyError
end
rescue => e
RemoteLogger.notify message: "PowerDNS rectify script failed for #{fqdn}.", fqdn: fqdn, output: output
Airbrake.notify_or_ignore e, parameters: { fqdn: fqdn, output: output }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment