1
0
mirror of https://github.com/github/octodns.git synced 2024-05-11 05:55:00 +00:00

Implement populate exists for RackspaceProvider

This commit is contained in:
Ross McFarland
2018-01-21 14:44:36 -08:00
parent 4d180ed991
commit d35fcd319a
2 changed files with 6 additions and 3 deletions

View File

@@ -208,7 +208,7 @@ class RackspaceProvider(BaseProvider):
raise Exception('Rackspace request unauthorized')
elif e.response.status_code == 404:
# Zone not found leaves the zone empty instead of failing.
return
return False
raise
before = len(zone.records)
@@ -225,8 +225,9 @@ class RackspaceProvider(BaseProvider):
source=self)
zone.add_record(record)
self.log.info('populate: found %s records',
self.log.info('populate: found %s records, exists=True',
len(zone.records) - before)
return True
def _group_records(self, all_records):
records = defaultdict(lambda: defaultdict(list))

View File

@@ -73,9 +73,10 @@ class TestRackspaceProvider(TestCase):
json={'error': "Could not find domain 'unit.tests.'"})
zone = Zone('unit.tests.', [])
self.provider.populate(zone)
exists = self.provider.populate(zone)
self.assertEquals(set(), zone.records)
self.assertTrue(mock.called_once)
self.assertFalse(exists)
def test_multipage_populate(self):
with requests_mock() as mock:
@@ -109,6 +110,7 @@ class TestRackspaceProvider(TestCase):
plan = self.provider.plan(expected)
self.assertTrue(mock.called)
self.assertTrue(plan.exists)
# OctoDNS does not propagate top-level NS records.
self.assertEquals(1, len(plan.changes))