Stop using deprecated 'message' attribute in Exception
The 'message' attribute has been deprecated and removed from Python3. For more details, please check: https://www.python.org/dev/peps/pep-0352/ Change-Id: Ib3f142812c66354eadec3e5224f70f3ef8ce0e33
This commit is contained in:
parent
9a2f65e39d
commit
be73e7939b
@ -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
|
||||
@ -577,7 +578,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.')
|
||||
@ -597,8 +598,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='1')
|
||||
@ -615,8 +615,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='1')
|
||||
@ -634,8 +633,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='1')
|
||||
|
Loading…
Reference in New Issue
Block a user