From 3451c79c6ac012a3dda29fdca36234a5bfe0966f Mon Sep 17 00:00:00 2001 From: Cadu Ribeiro Date: Wed, 21 Apr 2021 12:41:11 -0300 Subject: [PATCH] Change DNSimple's Provider to query zones instead domains A quick summary of a problem with have with DNSimple provider: Let's suppose that I have the following config: zones: 30.114.195.in-addr.arpa.: sources: - config targets: - dnsimple Even if a customer has this Reverse zone configured in DNSimple, this fails with: 400 Bad Request for url: https://api.sandbox.dnsimple.com/v2/x/domains because it is trying to create a domain because the zone wasn't found. octodns.provider.dnsimple.DnsimpleClientNotFound: Not found This happens because the GET /domains endpoint at DNSimple does not bring Reverse Zones. To make this work nice, we should use /zones/ instead making it return properly the reverse zones. --- octodns/provider/dnsimple.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/octodns/provider/dnsimple.py b/octodns/provider/dnsimple.py index 599eacb..a4b9350 100644 --- a/octodns/provider/dnsimple.py +++ b/octodns/provider/dnsimple.py @@ -51,8 +51,8 @@ class DnsimpleClient(object): resp.raise_for_status() return resp - def domain(self, name): - path = '/domains/{}'.format(name) + def zone(self, name): + path = '/zones/{}'.format(name) return self._request('GET', path).json() def domain_create(self, name): @@ -442,7 +442,7 @@ class DnsimpleProvider(BaseProvider): domain_name = desired.name[:-1] try: - self._client.domain(domain_name) + self._client.zone(domain_name) except DnsimpleClientNotFound: self.log.debug('_apply: no matching zone, creating domain') self._client.domain_create(domain_name)