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

Add CAA record type for ovh provider

This commit is contained in:
Charles
2020-01-21 16:44:20 +01:00
parent 4cce2f525e
commit 01ec880f83

View File

@@ -40,8 +40,8 @@ class OvhProvider(BaseProvider):
# This variable is also used in populate method to filter which OVH record
# types are supported by octodns
SUPPORTS = set(('A', 'AAAA', 'CNAME', 'DKIM', 'MX', 'NAPTR', 'NS', 'PTR',
'SPF', 'SRV', 'SSHFP', 'TXT'))
SUPPORTS = set(('A', 'AAAA', 'CAA', 'CNAME', 'DKIM', 'MX', 'NAPTR', 'NS',
'PTR', 'SPF', 'SRV', 'SSHFP', 'TXT'))
def __init__(self, id, endpoint, application_key, application_secret,
consumer_key, *args, **kwargs):
@@ -139,6 +139,22 @@ class OvhProvider(BaseProvider):
'value': record['target']
}
@staticmethod
def _data_for_CAA(_type, records):
values = []
for record in records:
flags, tag, value = record['target'].split(' ', 2)
values.append({
'flags': flags,
'tag': tag,
'value': value[1:-1]
})
return {
'ttl': records[0]['ttl'],
'type': _type,
'values': values
}
@staticmethod
def _data_for_MX(_type, records):
values = []
@@ -244,6 +260,16 @@ class OvhProvider(BaseProvider):
'fieldType': record._type
}
@staticmethod
def _params_for_CAA(record):
for value in record.values:
yield {
'target': '%d %s "%s"' % (value.flags, value.tag, value.value),
'subDomain': record.name,
'ttl': record.ttl,
'fieldType': record._type
}
@staticmethod
def _params_for_MX(record):
for value in record.values: