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

populating existing provider state is lenient

- adds lenient flag to Record.new, problems during validation are just
  warnings if it's true
- target populate calls during the plan phase pass lenient=True
- make all of the provider.populate call logging consistent including both
  target and lenient
- add source=self to Record.new in a few places that were missing it
This commit is contained in:
Ross McFarland
2017-06-23 09:01:25 -07:00
parent 8323b4c0ea
commit a97818b6ec
15 changed files with 90 additions and 42 deletions

View File

@@ -643,6 +643,7 @@ class TestRecordValidation(TestCase):
'value': '1.2.3.4',
})
self.assertEquals(['missing ttl'], ctx.exception.reasons)
# invalid ttl
with self.assertRaises(ValidationError) as ctx:
Record.new(self.zone, 'www', {
@@ -653,6 +654,21 @@ class TestRecordValidation(TestCase):
self.assertEquals('www.unit.tests.', ctx.exception.fqdn)
self.assertEquals(['invalid ttl'], ctx.exception.reasons)
# no exception if we're in lenient mode
Record.new(self.zone, 'www', {
'type': 'A',
'ttl': -1,
'value': '1.2.3.4',
}, lenient=True)
# __init__ may still blow up, even if validation is lenient
with self.assertRaises(KeyError) as ctx:
Record.new(self.zone, 'www', {
'type': 'A',
'ttl': -1,
}, lenient=True)
self.assertEquals(('value',), ctx.exception.args)
def test_A_and_values_mixin(self):
# doesn't blow up
Record.new(self.zone, '', {