Merge "Stop using deprecated 'message' attribute in Exception"
This commit is contained in:
commit
40d5d20d61
|
@ -2683,7 +2683,8 @@ class Service(service.RPCService, service.Service):
|
|||
except Exception as e:
|
||||
msg = _LE('An undefined error occurred during zone import')
|
||||
LOG.exception(msg)
|
||||
msg = 'An undefined error occurred. %s' % e.message[:130]
|
||||
msg = 'An undefined error occurred. %s'\
|
||||
% six.text_type(e)[:130]
|
||||
zone_import.message = msg
|
||||
zone_import.status = 'ERROR'
|
||||
|
||||
|
@ -2706,12 +2707,13 @@ class Service(service.RPCService, service.Service):
|
|||
zone_import.message = 'Duplicate zone.'
|
||||
except exceptions.InvalidTTL as e:
|
||||
zone_import.status = 'ERROR'
|
||||
zone_import.message = e.message
|
||||
zone_import.message = six.text_type(e)
|
||||
except Exception as e:
|
||||
msg = _LE('An undefined error occurred during zone '
|
||||
'import creation')
|
||||
LOG.exception(msg)
|
||||
msg = 'An undefined error occurred. %s' % e.message[:130]
|
||||
msg = 'An undefined error occurred. %s'\
|
||||
% six.text_type(e)[:130]
|
||||
zone_import.message = msg
|
||||
zone_import.status = 'ERROR'
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ class XFRMixin(object):
|
|||
dnspython_zone = dnsutils.do_axfr(zone.name, servers,
|
||||
timeout=timeout)
|
||||
except exceptions.XFRFailure as e:
|
||||
LOG.warning(e.message)
|
||||
LOG.warning(e)
|
||||
return
|
||||
|
||||
zone.update(dnsutils.from_dnspython_zone(dnspython_zone))
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import six
|
||||
import unittest
|
||||
|
||||
from mock import Mock
|
||||
|
@ -585,7 +586,7 @@ class CentralZoneTestCase(CentralBasic):
|
|||
with testtools.ExpectedException(exceptions.InvalidRecordSetName) as e:
|
||||
self.service._is_valid_recordset_name(self.context, zone,
|
||||
rs_name)
|
||||
self.assertEqual(e.message, 'Name too long')
|
||||
self.assertEqual(six.text_type(e), 'Name too long')
|
||||
|
||||
def test__is_valid_recordset_name_wrong_zone(self):
|
||||
zone = RoObject(name='example.org.')
|
||||
|
@ -605,8 +606,7 @@ class CentralZoneTestCase(CentralBasic):
|
|||
)
|
||||
self.assertEqual(
|
||||
'CNAME recordsets may not be created at the zone apex',
|
||||
e.message
|
||||
)
|
||||
six.text_type(e))
|
||||
|
||||
def test_is_valid_recordset_placement_failing(self):
|
||||
zone = RoObject(name='example.org.', id=CentralZoneTestCase.zone__id)
|
||||
|
@ -623,8 +623,7 @@ class CentralZoneTestCase(CentralBasic):
|
|||
)
|
||||
self.assertEqual(
|
||||
'CNAME recordsets may not share a name with any other records',
|
||||
e.message
|
||||
)
|
||||
six.text_type(e))
|
||||
|
||||
def test_is_valid_recordset_placement_failing_2(self):
|
||||
zone = RoObject(name='example.org.', id=CentralZoneTestCase.zone__id)
|
||||
|
@ -642,8 +641,7 @@ class CentralZoneTestCase(CentralBasic):
|
|||
)
|
||||
self.assertEqual(
|
||||
'CNAME recordsets may not share a name with any other records',
|
||||
e.message
|
||||
)
|
||||
six.text_type(e))
|
||||
|
||||
def test_is_valid_recordset_placement(self):
|
||||
zone = RoObject(name='example.org.', id=CentralZoneTestCase.zone__id)
|
||||
|
|
Loading…
Reference in New Issue