Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the PowerDNS-Admin API #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ certbot-dns-powerdns

PowerDNS DNS Authenticator plugin for [Certbot](https://certbot.eff.org/).

Compatibility:
* PowerDNS Authoritative Server API
* PowerDNS-Admin API

This plugin is built from the ground up and follows the development style and life-cycle
of other `certbot-dns-*` plugins found in the
[Official Certbot Repository](https://github.com/certbot/certbot).
Expand Down
12 changes: 5 additions & 7 deletions certbot_dns_powerdns/dns_powerdns.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,9 @@ def __init__(self, api_url, api_key, ttl):
self.provider = powerdns.Provider(config)

def _handle_http_error(self, e, domain_name):
if domain_name in str(e) and (
# 4.0 and 4.1 compatibility
str(e).startswith('422 Client Error: Unprocessable Entity for url:') or
# 4.2
str(e).startswith('404 Client Error: Not Found for url:')
):
return # Expected errors when zone name guess is wrong
# Depending on server and API version, we expect certain error codes while trying
# to guess the correct zone name. Ignore.
if domain_name in e.response.url and e.response.status_code in [403, 404, 422]:
return

return super(_PowerDNSLexiconClient, self)._handle_http_error(e, domain_name)