Browse Source

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.
pull/134/head
Ross McFarland 8 years ago
parent
commit
bf4f7dd42d
No known key found for this signature in database GPG Key ID: 61C10C4FC8FE4A89
2 changed files with 14 additions and 0 deletions
  1. +4
    -0
      octodns/record.py
  2. +10
    -0
      tests/test_octodns_record.py

+ 4
- 0
octodns/record.py View File

@ -95,6 +95,10 @@ class Record(object):
except KeyError:
raise Exception('Unknown record type: "{}"'.format(_type))
reasons = _class.validate(name, data)
try:
lenient |= data['octodns']['lenient']
except KeyError:
pass
if reasons:
if lenient:
cls.log.warn(ValidationError.build_message(fqdn, reasons))


+ 10
- 0
tests/test_octodns_record.py View File

@ -733,6 +733,16 @@ class TestRecordValidation(TestCase):
}, lenient=True)
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):
# doesn't blow up
Record.new(self.zone, '', {


Loading…
Cancel
Save