From b178e49c439387fe5bda9295abef092684195b84 Mon Sep 17 00:00:00 2001 From: Eric Barrett Date: Thu, 21 Mar 2019 14:35:20 -0400 Subject: [PATCH] Enable Exception.message Deprecated/Removed Error Flake8 currently ignores 'BaseException.message' removed in python3 Enable B306 for more thorough testing of code Change-Id: I9fbb01e8f61d679f4e611324efca6017c3b210e8 Story: 2004515 Task: 30076 Signed-off-by: Eric Barrett --- ceph/ceph-manager/ceph-manager/ceph_manager/monitor.py | 6 +++--- tools/engtools/hostdata-collectors/scripts/live_stream.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ceph/ceph-manager/ceph-manager/ceph_manager/monitor.py b/ceph/ceph-manager/ceph-manager/ceph_manager/monitor.py index 364ac96d..5ddfca59 100644 --- a/ceph/ceph-manager/ceph-manager/ceph_manager/monitor.py +++ b/ceph/ceph-manager/ceph-manager/ceph_manager/monitor.py @@ -60,7 +60,7 @@ class HandleUpgradesMixin(object): except IOError as e: raise exception.CephApiFailure( call="osd_set_key", - reason=e.message) + reason=str(e)) else: if not response.ok: raise exception.CephSetKeyFailure( @@ -299,7 +299,7 @@ class Monitor(HandleUpgradesMixin): response, fsid = self.service.ceph_api.fsid( body='text', timeout=30) except IOError as e: - LOG.warning(_LW("ceph_api.fsid failed: %s") % str(e.message)) + LOG.warning(_LW("ceph_api.fsid failed: %s") % str(e)) self.cluster_is_up = False return None @@ -317,7 +317,7 @@ class Monitor(HandleUpgradesMixin): response, body = self.service.ceph_api.health( body='text', timeout=30) except IOError as e: - LOG.warning(_LW("ceph_api.health failed: %s") % str(e.message)) + LOG.warning(_LW("ceph_api.health failed: %s") % str(e)) self.cluster_is_up = False return {'health': constants.CEPH_HEALTH_DOWN, 'detail': 'Ceph cluster is down.'} diff --git a/tools/engtools/hostdata-collectors/scripts/live_stream.py b/tools/engtools/hostdata-collectors/scripts/live_stream.py index 7346b44f..09d9ae41 100644 --- a/tools/engtools/hostdata-collectors/scripts/live_stream.py +++ b/tools/engtools/hostdata-collectors/scripts/live_stream.py @@ -1264,7 +1264,7 @@ def createDB(influx_info, grafana_port, grafana_api_key): if p is not None: p.kill() except Exception as e: - print(e.message) + print(str(e)) sys.exit(0) @@ -1308,7 +1308,7 @@ def deleteDB(influx_info, grafana_port, grafana_api_key): if p is not None: p.kill() except Exception as e: - print(e.message) + print(str(e)) sys.exit(0)