Browse Source

Remove trailing dot on all record types that take an fqdn.

pull/165/head
Terrence Cole 9 years ago
parent
commit
a9f3384d11
2 changed files with 41 additions and 41 deletions
  1. +3
    -3
      octodns/provider/rackspace.py
  2. +38
    -38
      tests/test_octodns_provider_rackspace.py

+ 3
- 3
octodns/provider/rackspace.py View File

@ -311,7 +311,7 @@ class RackspaceProvider(BaseProvider):
@staticmethod @staticmethod
def _record_for_named(record, value): def _record_for_named(record, value):
return { return {
'name': record.fqdn,
'name': remove_trailing_dot(record.fqdn),
'type': record._type, 'type': record._type,
'data': remove_trailing_dot(value), 'data': remove_trailing_dot(value),
'ttl': max(record.ttl, 300), 'ttl': max(record.ttl, 300),
@ -324,7 +324,7 @@ class RackspaceProvider(BaseProvider):
@staticmethod @staticmethod
def _record_for_textual(record, value): def _record_for_textual(record, value):
return { return {
'name': record.fqdn,
'name': remove_trailing_dot(record.fqdn),
'type': record._type, 'type': record._type,
'data': unescape_semicolon(value), 'data': unescape_semicolon(value),
'ttl': max(record.ttl, 300), 'ttl': max(record.ttl, 300),
@ -335,7 +335,7 @@ class RackspaceProvider(BaseProvider):
@staticmethod @staticmethod
def _record_for_MX(record, value): def _record_for_MX(record, value):
return { return {
'name': record.fqdn,
'name': remove_trailing_dot(record.fqdn),
'type': record._type, 'type': record._type,
'data': remove_trailing_dot(value), 'data': remove_trailing_dot(value),
'ttl': max(record.ttl, 300), 'ttl': max(record.ttl, 300),


+ 38
- 38
tests/test_octodns_provider_rackspace.py View File

@ -49,7 +49,7 @@ class TestRackspaceProvider(TestCase):
self.maxDiff = 1000 self.maxDiff = 1000
with requests_mock() as mock: with requests_mock() as mock:
mock.post(ANY, status_code=200, text=AUTH_RESPONSE) mock.post(ANY, status_code=200, text=AUTH_RESPONSE)
self.provider = RackspaceProvider(id, 'test', 'api-key')
self.provider = RackspaceProvider(id, 'test', 'api-key', '0')
self.assertTrue(mock.called_once) self.assertTrue(mock.called_once)
def test_bad_auth(self): def test_bad_auth(self):
@ -233,19 +233,19 @@ class TestRackspaceProvider(TestCase):
OwnRecords = { OwnRecords = {
"totalEntries": 3, "totalEntries": 3,
"records": [{ "records": [{
"name": "unit.tests.",
"name": "unit.tests",
"id": "A-111111", "id": "A-111111",
"type": "A", "type": "A",
"data": "1.2.3.4", "data": "1.2.3.4",
"ttl": 300 "ttl": 300
}, { }, {
"name": "unit.tests.",
"name": "unit.tests",
"id": "A-222222", "id": "A-222222",
"type": "A", "type": "A",
"data": "1.2.3.5", "data": "1.2.3.5",
"ttl": 300 "ttl": 300
}, { }, {
"name": "unit.tests.",
"name": "unit.tests",
"id": "A-333333", "id": "A-333333",
"type": "A", "type": "A",
"data": "1.2.3.6", "data": "1.2.3.6",
@ -281,13 +281,13 @@ class TestRackspaceProvider(TestCase):
OwnRecords = { OwnRecords = {
"totalEntries": 3, "totalEntries": 3,
"records": [{ "records": [{
"name": "foo.unit.tests.",
"name": "foo.unit.tests",
"id": "A-111111", "id": "A-111111",
"type": "A", "type": "A",
"data": "1.2.3.4", "data": "1.2.3.4",
"ttl": 300 "ttl": 300
}, { }, {
"name": "bar.unit.tests.",
"name": "bar.unit.tests",
"id": "A-222222", "id": "A-222222",
"type": "A", "type": "A",
"data": "1.2.3.4", "data": "1.2.3.4",
@ -327,12 +327,12 @@ class TestRackspaceProvider(TestCase):
ExpectChanges = True ExpectChanges = True
ExpectedAdditions = { ExpectedAdditions = {
"records": [{ "records": [{
"name": "unit.tests.",
"name": "unit.tests",
"type": "A", "type": "A",
"data": "1.2.3.4", "data": "1.2.3.4",
"ttl": 300 "ttl": 300
}, { }, {
"name": "foo.unit.tests.",
"name": "foo.unit.tests",
"type": "NS", "type": "NS",
"data": "ns.example.com", "data": "ns.example.com",
"ttl": 300 "ttl": 300
@ -369,27 +369,27 @@ class TestRackspaceProvider(TestCase):
ExpectChanges = True ExpectChanges = True
ExpectedAdditions = { ExpectedAdditions = {
"records": [{ "records": [{
"name": "unit.tests.",
"name": "unit.tests",
"type": "A", "type": "A",
"data": "1.2.3.4", "data": "1.2.3.4",
"ttl": 300 "ttl": 300
}, { }, {
"name": "unit.tests.",
"name": "unit.tests",
"type": "A", "type": "A",
"data": "1.2.3.5", "data": "1.2.3.5",
"ttl": 300 "ttl": 300
}, { }, {
"name": "unit.tests.",
"name": "unit.tests",
"type": "A", "type": "A",
"data": "1.2.3.6", "data": "1.2.3.6",
"ttl": 300 "ttl": 300
}, { }, {
"name": "foo.unit.tests.",
"name": "foo.unit.tests",
"type": "NS", "type": "NS",
"data": "ns1.example.com", "data": "ns1.example.com",
"ttl": 300 "ttl": 300
}, { }, {
"name": "foo.unit.tests.",
"name": "foo.unit.tests",
"type": "NS", "type": "NS",
"data": "ns2.example.com", "data": "ns2.example.com",
"ttl": 300 "ttl": 300
@ -431,17 +431,17 @@ class TestRackspaceProvider(TestCase):
ExpectChanges = True ExpectChanges = True
ExpectedAdditions = { ExpectedAdditions = {
"records": [{ "records": [{
"name": "bar.unit.tests.",
"name": "bar.unit.tests",
"type": "A", "type": "A",
"data": "1.2.3.4", "data": "1.2.3.4",
"ttl": 300 "ttl": 300
}, { }, {
"name": "foo.unit.tests.",
"name": "foo.unit.tests",
"type": "A", "type": "A",
"data": "1.2.3.4", "data": "1.2.3.4",
"ttl": 300 "ttl": 300
}, { }, {
"name": "foo.unit.tests.",
"name": "foo.unit.tests",
"type": "NS", "type": "NS",
"data": "ns.example.com", "data": "ns.example.com",
"ttl": 300 "ttl": 300
@ -457,13 +457,13 @@ class TestRackspaceProvider(TestCase):
OwnRecords = { OwnRecords = {
"totalEntries": 1, "totalEntries": 1,
"records": [{ "records": [{
"name": "unit.tests.",
"name": "unit.tests",
"id": "A-111111", "id": "A-111111",
"type": "A", "type": "A",
"data": "1.2.3.4", "data": "1.2.3.4",
"ttl": 300 "ttl": 300
}, { }, {
"name": "foo.unit.tests.",
"name": "foo.unit.tests",
"id": "NS-111111", "id": "NS-111111",
"type": "NS", "type": "NS",
"data": "ns.example.com", "data": "ns.example.com",
@ -491,25 +491,25 @@ class TestRackspaceProvider(TestCase):
OwnRecords = { OwnRecords = {
"totalEntries": 3, "totalEntries": 3,
"records": [{ "records": [{
"name": "unit.tests.",
"name": "unit.tests",
"id": "A-111111", "id": "A-111111",
"type": "A", "type": "A",
"data": "1.2.3.4", "data": "1.2.3.4",
"ttl": 300 "ttl": 300
}, { }, {
"name": "unit.tests.",
"name": "unit.tests",
"id": "A-222222", "id": "A-222222",
"type": "A", "type": "A",
"data": "1.2.3.5", "data": "1.2.3.5",
"ttl": 300 "ttl": 300
}, { }, {
"name": "unit.tests.",
"name": "unit.tests",
"id": "A-333333", "id": "A-333333",
"type": "A", "type": "A",
"data": "1.2.3.6", "data": "1.2.3.6",
"ttl": 300 "ttl": 300
}, { }, {
"name": "foo.unit.tests.",
"name": "foo.unit.tests",
"id": "NS-111111", "id": "NS-111111",
"type": "NS", "type": "NS",
"data": "ns.example.com", "data": "ns.example.com",
@ -521,7 +521,7 @@ class TestRackspaceProvider(TestCase):
ExpectedDeletions = "id=A-111111&id=A-333333&id=NS-111111" ExpectedDeletions = "id=A-111111&id=A-333333&id=NS-111111"
ExpectedUpdates = { ExpectedUpdates = {
"records": [{ "records": [{
"name": "unit.tests.",
"name": "unit.tests",
"id": "A-222222", "id": "A-222222",
"data": "1.2.3.5", "data": "1.2.3.5",
"ttl": 300 "ttl": 300
@ -544,19 +544,19 @@ class TestRackspaceProvider(TestCase):
OwnRecords = { OwnRecords = {
"totalEntries": 3, "totalEntries": 3,
"records": [{ "records": [{
"name": "unit.tests.",
"name": "unit.tests",
"id": "A-111111", "id": "A-111111",
"type": "A", "type": "A",
"data": "1.2.3.4", "data": "1.2.3.4",
"ttl": 300 "ttl": 300
}, { }, {
"name": "foo.unit.tests.",
"name": "foo.unit.tests",
"id": "A-222222", "id": "A-222222",
"type": "A", "type": "A",
"data": "1.2.3.5", "data": "1.2.3.5",
"ttl": 300 "ttl": 300
}, { }, {
"name": "bar.unit.tests.",
"name": "bar.unit.tests",
"id": "A-333333", "id": "A-333333",
"type": "A", "type": "A",
"data": "1.2.3.6", "data": "1.2.3.6",
@ -584,7 +584,7 @@ class TestRackspaceProvider(TestCase):
OwnRecords = { OwnRecords = {
"totalEntries": 1, "totalEntries": 1,
"records": [{ "records": [{
"name": "unit.tests.",
"name": "unit.tests",
"id": "A-111111", "id": "A-111111",
"type": "A", "type": "A",
"data": "1.2.3.4", "data": "1.2.3.4",
@ -596,7 +596,7 @@ class TestRackspaceProvider(TestCase):
ExpectedDeletions = None ExpectedDeletions = None
ExpectedUpdates = { ExpectedUpdates = {
"records": [{ "records": [{
"name": "unit.tests.",
"name": "unit.tests",
"id": "A-111111", "id": "A-111111",
"data": "1.2.3.4", "data": "1.2.3.4",
"ttl": 3600 "ttl": 3600
@ -619,19 +619,19 @@ class TestRackspaceProvider(TestCase):
OwnRecords = { OwnRecords = {
"totalEntries": 3, "totalEntries": 3,
"records": [{ "records": [{
"name": "unit.tests.",
"name": "unit.tests",
"id": "A-111111", "id": "A-111111",
"type": "A", "type": "A",
"data": "1.2.3.4", "data": "1.2.3.4",
"ttl": 300 "ttl": 300
}, { }, {
"name": "unit.tests.",
"name": "unit.tests",
"id": "A-222222", "id": "A-222222",
"type": "A", "type": "A",
"data": "1.2.3.5", "data": "1.2.3.5",
"ttl": 300 "ttl": 300
}, { }, {
"name": "unit.tests.",
"name": "unit.tests",
"id": "A-333333", "id": "A-333333",
"type": "A", "type": "A",
"data": "1.2.3.6", "data": "1.2.3.6",
@ -643,17 +643,17 @@ class TestRackspaceProvider(TestCase):
ExpectedDeletions = None ExpectedDeletions = None
ExpectedUpdates = { ExpectedUpdates = {
"records": [{ "records": [{
"name": "unit.tests.",
"name": "unit.tests",
"id": "A-111111", "id": "A-111111",
"data": "1.2.3.4", "data": "1.2.3.4",
"ttl": 3600 "ttl": 3600
}, { }, {
"name": "unit.tests.",
"name": "unit.tests",
"id": "A-222222", "id": "A-222222",
"data": "1.2.3.5", "data": "1.2.3.5",
"ttl": 3600 "ttl": 3600
}, { }, {
"name": "unit.tests.",
"name": "unit.tests",
"id": "A-333333", "id": "A-333333",
"data": "1.2.3.6", "data": "1.2.3.6",
"ttl": 3600 "ttl": 3600
@ -684,13 +684,13 @@ class TestRackspaceProvider(TestCase):
OwnRecords = { OwnRecords = {
"totalEntries": 2, "totalEntries": 2,
"records": [{ "records": [{
"name": "foo.unit.tests.",
"name": "foo.unit.tests",
"id": "A-111111", "id": "A-111111",
"type": "A", "type": "A",
"data": "1.2.3.4", "data": "1.2.3.4",
"ttl": 300 "ttl": 300
}, { }, {
"name": "bar.unit.tests.",
"name": "bar.unit.tests",
"id": "A-222222", "id": "A-222222",
"type": "A", "type": "A",
"data": "1.2.3.4", "data": "1.2.3.4",
@ -702,12 +702,12 @@ class TestRackspaceProvider(TestCase):
ExpectedDeletions = None ExpectedDeletions = None
ExpectedUpdates = { ExpectedUpdates = {
"records": [{ "records": [{
"name": "bar.unit.tests.",
"name": "bar.unit.tests",
"id": "A-222222", "id": "A-222222",
"data": "1.2.3.4", "data": "1.2.3.4",
"ttl": 3600 "ttl": 3600
}, { }, {
"name": "foo.unit.tests.",
"name": "foo.unit.tests",
"id": "A-111111", "id": "A-111111",
"data": "1.2.3.4", "data": "1.2.3.4",
"ttl": 3600 "ttl": 3600


Loading…
Cancel
Save