1
0
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:
Adam Smith
2017-11-23 21:49:14 -08:00
parent 7fc437dba5
commit ef8d66ff9c
2 changed files with 10 additions and 5 deletions

View File

@@ -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):

View File

@@ -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,