diff --git a/octodns/provider/ovh.py b/octodns/provider/ovh.py index 8a3d492..182639c 100644 --- a/octodns/provider/ovh.py +++ b/octodns/provider/ovh.py @@ -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: