mirror of
https://github.com/github/octodns.git
synced 2024-05-11 05:55:00 +00:00
Allow enabling lenient on a per-record basis with octodns.lenient
```
---
'':
octodns:
ignored: True
lenient: True
type: CNAME # not valid to have a root cname
value: foo.com.
This commit is contained in:
@@ -95,6 +95,10 @@ class Record(object):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
raise Exception('Unknown record type: "{}"'.format(_type))
|
raise Exception('Unknown record type: "{}"'.format(_type))
|
||||||
reasons = _class.validate(name, data)
|
reasons = _class.validate(name, data)
|
||||||
|
try:
|
||||||
|
lenient |= data['octodns']['lenient']
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
if reasons:
|
if reasons:
|
||||||
if lenient:
|
if lenient:
|
||||||
cls.log.warn(ValidationError.build_message(fqdn, reasons))
|
cls.log.warn(ValidationError.build_message(fqdn, reasons))
|
||||||
|
|||||||
@@ -733,6 +733,16 @@ class TestRecordValidation(TestCase):
|
|||||||
}, lenient=True)
|
}, lenient=True)
|
||||||
self.assertEquals(('value',), ctx.exception.args)
|
self.assertEquals(('value',), ctx.exception.args)
|
||||||
|
|
||||||
|
# no exception if we're in lenient mode from config
|
||||||
|
Record.new(self.zone, 'www', {
|
||||||
|
'octodns': {
|
||||||
|
'lenient': True
|
||||||
|
},
|
||||||
|
'type': 'A',
|
||||||
|
'ttl': -1,
|
||||||
|
'value': '1.2.3.4',
|
||||||
|
}, lenient=True)
|
||||||
|
|
||||||
def test_A_and_values_mixin(self):
|
def test_A_and_values_mixin(self):
|
||||||
# doesn't blow up
|
# doesn't blow up
|
||||||
Record.new(self.zone, '', {
|
Record.new(self.zone, '', {
|
||||||
|
|||||||
Reference in New Issue
Block a user