Fix bug in Manager when using Python 2.7

In Python 2.7 the if statement would catch both cases from the test
test_populate_lenient_fallback, so the test was failing. These are
the error strings differences between Python 2 and 3:

Python 2:
NoLenient: populate() got an unexpected keyword argument 'lenient'
NoZone: populate() got multiple values for keyword argument 'lenient'

Python 3:
NoLenient: populate() got an unexpected keyword argument 'lenient'
NoZone: populate() got multiple values for argument 'lenient'
This commit is contained in:
blanariu
2021-06-24 12:39:56 +03:00
parent 6cac4b060a
commit 3cc0fac817
+2 -1
View File
@@ -243,7 +243,8 @@ class Manager(object):
try:
source.populate(zone, lenient=lenient)
except TypeError as e:
if "keyword argument 'lenient'" not in text_type(e):
if ("unexpected keyword argument 'lenient'"
not in text_type(e)):
raise
self.log.warn(': provider %s does not accept lenient '
'param', source.__class__.__name__)