mirror of
https://github.com/github/octodns.git
synced 2024-05-11 05:55:00 +00:00
Transform @ in Digitalocean API output to zone name
This commit is contained in:
@@ -82,18 +82,23 @@ class DigitalOceanClient(object):
|
||||
except KeyError:
|
||||
break
|
||||
|
||||
# change any apex record to empty string to match other provider output
|
||||
for record in ret:
|
||||
# change any apex record to empty string
|
||||
if record['name'] == '@':
|
||||
record['name'] = ''
|
||||
|
||||
# change any apex value to zone name
|
||||
if record['data'] == '@':
|
||||
record['data'] = zone_name
|
||||
|
||||
return ret
|
||||
|
||||
def record_create(self, zone_name, params):
|
||||
path = '/domains/{}/records'.format(zone_name)
|
||||
# change empty string to @, DigitalOcean uses @ for apex record names
|
||||
# change empty name string to @, DO uses @ for apex record names
|
||||
if params['name'] == '':
|
||||
params['name'] = '@'
|
||||
|
||||
self._request('POST', path, data=params)
|
||||
|
||||
def record_delete(self, zone_name, record_id):
|
||||
|
||||
4
tests/fixtures/digitalocean-page-2.json
vendored
4
tests/fixtures/digitalocean-page-2.json
vendored
@@ -25,7 +25,7 @@
|
||||
"id": 11189891,
|
||||
"type": "CNAME",
|
||||
"name": "cname",
|
||||
"data": "unit.tests",
|
||||
"data": "@",
|
||||
"priority": null,
|
||||
"port": null,
|
||||
"ttl": 300,
|
||||
@@ -69,7 +69,7 @@
|
||||
"id": 11189895,
|
||||
"type": "CNAME",
|
||||
"name": "included",
|
||||
"data": "unit.tests",
|
||||
"data": "@",
|
||||
"priority": null,
|
||||
"port": null,
|
||||
"ttl": 3600,
|
||||
|
||||
Reference in New Issue
Block a user