Repository navigation
Conversation
The Zerigo DNS service was permanently shut down on April 30, 2017.
The DNSimple v1 API was shutdown on May 31, 2018:
https://blog.dnsimple.com/2018/03/api-v1-shutdown-notice/
The RcodeZero v1 API has been shutdown:
https://my.rcodezero.at/openapi/
Enable unit tests to verify HTTP requests they submit.
* Fix test_create_zone_success * Fix test_get_record_success
* Fix test_update_zone
Leverage the existing get_record.json for this test.
Previously, test_get_record_success() succeeded when receiving a record completely unrelated to the originating .get_record() request. Update the request to align with the expected response.
Previously, test_list_records_success() succeeded when receiving records completely unrelated to the originating .list_records() request. Update the request to align with the expected response.
Add .hostname(), .fqdn(), and .prefix() helpers to the Zone class. Each of these functions accepts a host prefix, complete name (unrooted hostname), or FQDN (rooted hostname) associated with the Zone object and returns the format implied by the function name.
Add .to_default_id() and .from_default_id() functions to the DNSDriver class. These functions support the <type>[:<name>] (e.g. "A:www") record ID format used by many of the drivers.
Previously, our NsOneDNSDriver.get_record() function performed lookups
using a `record_id` format that differed from the ID embedded within the
returned Record instance, so the driver leveraged two independent
record ID concepts simultaneously.
The NS1 API returns an ID when records are created, but that ID has no
local relevance. For example, it cannot be used to request the record
from the NS1 API.
Make the Record class .id value consistent between create_record() and
get_record(z.id, r.id).
| zone_id | z.id | r.id | record_id |
---------|----------|----------|---------------|---------------|
previous | z.domain | random* | random* | r.type |
next | z.domain | z.domain | r.type:r.name | r.type:r.name |
* no meaning, effectively random
* Fix TTL in test_create_record_success() request
* Align record update with parent zone in test_update_record_success()
* Fix record_id in test_get_record_success() request
DNS AAAA records are associated with IPv6 addresses.
* Fix "ttle" typo in test_update_record()
The "DYN" parameter is only defined for non-resellers:
https://www.worldwidedns.net/dns_api_protocol_new_domain.asp
The "ID" parameter is only defined for resellers:
https://www.worldwidedns.net/dns_api_protocol_new_domain_reseller.asp
Include "ID" parameter when reseller_id is set:
https://www.worldwidedns.net/dns_api_protocol_modify_reseller.asp
The update_record() and delete_record() functions require a Record
instance in their respective argument lists to identify the DNS record
to manipulate. Record objects instantiated by this driver contain the
assocated "slot" ID within the .id field, so:
1. There is no need for the user to specify the "slot" ID via
.update_record(..., extra={"entry": ID}). However, since it was
previously required, an "entry" key will be accepted as long as it is
consistent with the Record instance.
2. There is no need for .delete_record() to search the Record's zone for
the "slot" ID of the Record.
DNS drivers share the need to manipulate host/domain names, so let's add utility functions to the common Record and Zone classes to allow redundant code scattered throughout the various drivers to be consolidated into common and consistent implementations. * Record.name - no longer driver-dependent, now the host prefix or "" * Record.hostname - the complete host name, including domain part * Record.fqdn - the fully qualified domain name, including root dot * Zone.domain - no longer driver-dependent, now the unrooted domain * Zone.rooted() - format a (un)rooted domain as a rooted domain * Zone.unrooted() - format a (un)rooted domain as an unrooted domain
Update testing inputs to conform to spec'ed usage.
Leverage common code from DNSDriver, Record, and Zone classes for host name and record ID handling.
Drop RackspaceDNSDriver._to_partial_record_name() and RackspaceDNSDriver._to_full_record_name() in favor of the common support provided by the Record and Zone classes.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## trunk #2233 +/- ##
==========================================
+ Coverage 83.07% 83.08% +0.01%
==========================================
Files 343 341 -2
Lines 78661 79342 +681
Branches 8587 8579 -8
==========================================
+ Hits 65345 65920 +575
- Misses 10588 10710 +122
+ Partials 2728 2712 -16
🚀 New features to boost your workflow:
|
tisonkun
left a comment
There was a problem hiding this comment.
The DNS suite passes locally. I reproduced the name-handling issues below with mocked provider responses.
| Return the traditional fully qualified domain name, including full-stop | ||
| trailing dot, for this record. | ||
| """ | ||
| return self.zone.fqdn(self.name) |
There was a problem hiding this comment.
In zone example.com, deleting example.com.example.com. through Google Cloud DNS sends a deletion for example.com.. self.name is already relative. Please build the FQDN without stripping the suffix a second time and check that the record ID round-trips too.
There was a problem hiding this comment.
Fixed. Record.hostname and Record.fqdn now build from the already-normalized relative name, avoiding a second suffix removal. I also added coverage for example.com.example.com. and the default-ID round trip.
| id = ":".join((self.RECORD_TYPE_MAP[type], name)) | ||
| record = Record( | ||
| id=id, | ||
| id=self.to_default_id(zone, name, type), |
There was a problem hiding this comment.
list_records() raises ZoneNotRelatedError for an AWS response containing www.example.com.. The slice at line 570 leaves www. now that zone.domain has no trailing dot. Please pass the full name through and cover a dotted name in the fixture.
There was a problem hiding this comment.
Fixed. Route 53 now passes the full name returned by AWS through the Record model instead of slicing off the zone suffix. I added a dotted-name fixture and verified the record name and delete request.
| "rrsets": [ | ||
| { | ||
| "name": name, | ||
| "name": hostname, |
There was a problem hiding this comment.
With api_version="v1" (PowerDNS 4), creating or updating www.example.com. sends www.example.com, and deleting it sends just www. Please send the rooted FQDN for all three v4 operations and the full hostname for v3 deletes. PowerDNS request examples
There was a problem hiding this comment.
Fixed. PowerDNS v4 now sends rooted FQDNs for create, update, and delete; v3 deletes use the complete hostname. Tests cover the v4 request names and an update that omits name.
| self.assertEqual(sent.method, "PUT") | ||
| self.assertEqual(sent.url, f"/client/v4/zones/{zone.id}/dns_records/{record.id}") | ||
| self.assertEqual(sent.json["type"], "A") | ||
| self.assertEqual(sent.json["name"], "test6") |
There was a problem hiding this comment.
Please also cover an update that omits name. With the existing apex A record, record.update(data="192.0.2.2") sends "name": "". Cloudflare requires the full record name, so the PUT should carry example.com.
There was a problem hiding this comment.
Fixed. Added a regression test for updating an apex record without name; the PUT now sends the zone’s full name (example.com).
| from libcloud.dns.drivers.rcodezero import RcodeZeroDNSDriver | ||
|
|
||
|
|
||
| @unittest.skip("v1 API is deprecated") |
There was a problem hiding this comment.
The driver already defaults to /api/v2, and this class uses v2 fixtures. All 15 tests pass locally with the skip removed. Please keep the v2 driver and its tests enabled and limit the deprecation to v1.
There was a problem hiding this comment.
Fixed. Removed the blanket skip: this driver and its fixtures exercise the default v2 API. The v1 deprecation does not apply to this test suite.
| if name == domain: | ||
| return "" | ||
|
|
||
| if name.endswith(f".{domain}"): |
There was a problem hiding this comment.
For zone example.com, zone.prefix("www.EXAMPLE.COM.") raises ZoneNotRelatedError. Please compare the zone labels case-insensitively for both apex and suffix matches, while preserving the original prefix.
There was a problem hiding this comment.
Fixed. Zone apex and suffix matching is now case-insensitive, while preserving the original case of the returned prefix. Added tests for mixed-case rooted names.
| extra["priority"] = priority | ||
| return Record( | ||
| id="{}:{}".format(data["rrset_type"], data["rrset_name"]), | ||
| id=self.to_default_id(zone, data["rrset_name"], data["rrset_type"]), |
There was a problem hiding this comment.
The existing Gandi apex fixture has rrset_name="@", so record.fqdn becomes @.example.com.. Please map @ to the empty relative name on read and back to @ when sending an apex request.
There was a problem hiding this comment.
Fixed. Gandi Live maps @ to the empty relative name when reading records and maps the apex back to @ in API requests, including multi-value record creation. Added regression coverage.
Fix DNS driver API inconsistencies
Description
Moved from: #2066
Implement #2065
Summary
In general, commit messages provide necessary background regarding the changes made and why.
<type>[:<name>]-style record IDsRecord.idformat for NS1 and Zonomi providersRecord.idinterpretation for World Wide DNSStatus
Checklist (tick everything that applies)