mirror of
https://github.com/github/octodns.git
synced 2024-05-11 05:55:00 +00:00
Delete first and create last to avoid having create coalesce into an update unexpectedly.
This commit is contained in:
@@ -155,7 +155,7 @@ class RackspaceProvider(BaseProvider):
|
||||
def _key_for_record(cls, rs_record):
|
||||
return cls._as_unicode(rs_record['type'], 'ascii'),\
|
||||
cls._as_unicode(rs_record['name'], 'utf-8'),\
|
||||
cls._as_unicode(rs_record['data'], 'utf-8'),\
|
||||
cls._as_unicode(rs_record['data'], 'utf-8')
|
||||
|
||||
def _data_for_multiple(self, rrset):
|
||||
# TODO: geo not supported
|
||||
@@ -451,15 +451,15 @@ class RackspaceProvider(BaseProvider):
|
||||
elif change.__class__.__name__ == 'Delete':
|
||||
deletes += self._mod_Delete(change)
|
||||
|
||||
if creates:
|
||||
data = {"records": sorted(creates, key=lambda v: v['type'] + v['name'] + v.get('data', ''))}
|
||||
self._post('domains/{}/records'.format(domain_id), data=data)
|
||||
if deletes:
|
||||
params = "&".join(sorted(deletes))
|
||||
self._delete('domains/{}/records?{}'.format(domain_id, params))
|
||||
|
||||
if updates:
|
||||
data = {"records": sorted(updates, key=lambda v: v['name'])}
|
||||
self._put('domains/{}/records'.format(domain_id), data=data)
|
||||
|
||||
if deletes:
|
||||
params = "&".join(sorted(deletes))
|
||||
self._delete('domains/{}/records?{}'.format(domain_id, params))
|
||||
if creates:
|
||||
data = {"records": sorted(creates, key=lambda v: v['type'] + v['name'] + v.get('data', ''))}
|
||||
self._post('domains/{}/records'.format(domain_id), data=data)
|
||||
|
||||
|
@@ -708,6 +708,43 @@ class TestRackspaceProvider(TestCase):
|
||||
ExpectedUpdates = None
|
||||
return self._test_apply_with_data(TestData)
|
||||
|
||||
def test_apply_update_MX(self):
|
||||
class TestData(object):
|
||||
OtherRecords = [
|
||||
{
|
||||
"subdomain": '',
|
||||
"data": {
|
||||
'type': 'MX',
|
||||
'ttl': 300,
|
||||
'value': {u'priority': 50, u'value': 'mx.test.com.'}
|
||||
}
|
||||
}
|
||||
]
|
||||
OwnRecords = {
|
||||
"totalEntries": 1,
|
||||
"records": [{
|
||||
"name": "unit.tests",
|
||||
"id": "MX-111111",
|
||||
"type": "MX",
|
||||
"priority": 20,
|
||||
"data": "mx.test.com",
|
||||
"ttl": 300
|
||||
}]
|
||||
}
|
||||
ExpectChanges = True
|
||||
ExpectedAdditions = {
|
||||
"records": [{
|
||||
"name": "unit.tests",
|
||||
"type": "MX",
|
||||
"priority": 50,
|
||||
"data": "mx.test.com",
|
||||
"ttl": 300
|
||||
}]
|
||||
}
|
||||
ExpectedDeletions = 'id=MX-111111'
|
||||
ExpectedUpdates = None
|
||||
return self._test_apply_with_data(TestData)
|
||||
|
||||
def test_apply_multiple_updates(self):
|
||||
class TestData(object):
|
||||
OtherRecords = [
|
||||
|
Reference in New Issue
Block a user