mirror of
https://github.com/github/octodns.git
synced 2024-05-11 05:55:00 +00:00
Detect changes to LOC record correctly
This commit is contained in:
@@ -505,7 +505,7 @@ class CloudflareProvider(BaseProvider):
|
||||
# new records cleanly. In general when there are multiple records for a
|
||||
# name & type each will have a distinct/consistent `content` that can
|
||||
# serve as a unique identifier.
|
||||
# BUT... there are exceptions. MX, CAA, and SRV don't have a simple
|
||||
# BUT... there are exceptions. MX, CAA, LOC and SRV don't have a simple
|
||||
# content as things are currently implemented so we need to handle
|
||||
# those explicitly and create unique/hashable strings for them.
|
||||
_type = data['type']
|
||||
@@ -517,6 +517,22 @@ class CloudflareProvider(BaseProvider):
|
||||
elif _type == 'SRV':
|
||||
data = data['data']
|
||||
return '{port} {priority} {target} {weight}'.format(**data)
|
||||
elif _type == 'LOC':
|
||||
data = data['data']
|
||||
loc = (
|
||||
'{lat_degrees}',
|
||||
'{lat_minutes}',
|
||||
'{lat_seconds}',
|
||||
'{lat_direction}',
|
||||
'{long_degrees}',
|
||||
'{long_minutes}',
|
||||
'{long_seconds}',
|
||||
'{long_direction}',
|
||||
'{altitude}',
|
||||
'{size}',
|
||||
'{precision_horz}',
|
||||
'{precision_vert}')
|
||||
return ' '.join(loc).format(**data)
|
||||
return data['content']
|
||||
|
||||
def _apply_Create(self, change):
|
||||
|
||||
@@ -747,6 +747,23 @@ class TestCloudflareProvider(TestCase):
|
||||
},
|
||||
'type': 'SRV',
|
||||
}),
|
||||
('31 58 52.1 S 115 49 11.7 E 20 10 10 2', {
|
||||
'data': {
|
||||
'lat_degrees': 31,
|
||||
'lat_minutes': 58,
|
||||
'lat_seconds': 52.1,
|
||||
'lat_direction': 'S',
|
||||
'long_degrees': 115,
|
||||
'long_minutes': 49,
|
||||
'long_seconds': 11.7,
|
||||
'long_direction': 'E',
|
||||
'altitude': 20,
|
||||
'size': 10,
|
||||
'precision_horz': 10,
|
||||
'precision_vert': 2,
|
||||
},
|
||||
'type': 'LOC',
|
||||
}),
|
||||
):
|
||||
self.assertEqual(expected, provider._gen_key(data))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user