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:
|
except KeyError:
|
||||||
break
|
break
|
||||||
|
|
||||||
# change any apex record to empty string to match other provider output
|
|
||||||
for record in ret:
|
for record in ret:
|
||||||
|
# change any apex record to empty string
|
||||||
if record['name'] == '@':
|
if record['name'] == '@':
|
||||||
record['name'] = ''
|
record['name'] = ''
|
||||||
|
|
||||||
|
# change any apex value to zone name
|
||||||
|
if record['data'] == '@':
|
||||||
|
record['data'] = zone_name
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def record_create(self, zone_name, params):
|
def record_create(self, zone_name, params):
|
||||||
path = '/domains/{}/records'.format(zone_name)
|
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'] == '':
|
if params['name'] == '':
|
||||||
params['name'] = '@'
|
params['name'] = '@'
|
||||||
|
|
||||||
self._request('POST', path, data=params)
|
self._request('POST', path, data=params)
|
||||||
|
|
||||||
def record_delete(self, zone_name, record_id):
|
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,
|
"id": 11189891,
|
||||||
"type": "CNAME",
|
"type": "CNAME",
|
||||||
"name": "cname",
|
"name": "cname",
|
||||||
"data": "unit.tests",
|
"data": "@",
|
||||||
"priority": null,
|
"priority": null,
|
||||||
"port": null,
|
"port": null,
|
||||||
"ttl": 300,
|
"ttl": 300,
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
"id": 11189895,
|
"id": 11189895,
|
||||||
"type": "CNAME",
|
"type": "CNAME",
|
||||||
"name": "included",
|
"name": "included",
|
||||||
"data": "unit.tests",
|
"data": "@",
|
||||||
"priority": null,
|
"priority": null,
|
||||||
"port": null,
|
"port": null,
|
||||||
"ttl": 3600,
|
"ttl": 3600,
|
||||||
|
|||||||
Reference in New Issue
Block a user