-
-
Save hannesfostie/f38b34b3eafc38204d06 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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