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 <eric.barrett@windriver.com>
This commit is contained in:
parent
360ad25564
commit
c16a89581c
@ -60,7 +60,7 @@ class HandleUpgradesMixin(object):
|
|||||||
except IOError as e:
|
except IOError as e:
|
||||||
raise exception.CephApiFailure(
|
raise exception.CephApiFailure(
|
||||||
call="osd_set_key",
|
call="osd_set_key",
|
||||||
reason=e.message)
|
reason=str(e))
|
||||||
else:
|
else:
|
||||||
if not response.ok:
|
if not response.ok:
|
||||||
raise exception.CephSetKeyFailure(
|
raise exception.CephSetKeyFailure(
|
||||||
@ -299,7 +299,7 @@ class Monitor(HandleUpgradesMixin):
|
|||||||
response, fsid = self.service.ceph_api.fsid(
|
response, fsid = self.service.ceph_api.fsid(
|
||||||
body='text', timeout=30)
|
body='text', timeout=30)
|
||||||
except IOError as e:
|
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
|
self.cluster_is_up = False
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -317,7 +317,7 @@ class Monitor(HandleUpgradesMixin):
|
|||||||
response, body = self.service.ceph_api.health(
|
response, body = self.service.ceph_api.health(
|
||||||
body='text', timeout=30)
|
body='text', timeout=30)
|
||||||
except IOError as e:
|
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
|
self.cluster_is_up = False
|
||||||
return {'health': constants.CEPH_HEALTH_DOWN,
|
return {'health': constants.CEPH_HEALTH_DOWN,
|
||||||
'detail': 'Ceph cluster is down.'}
|
'detail': 'Ceph cluster is down.'}
|
||||||
|
@ -1264,7 +1264,7 @@ def createDB(influx_info, grafana_port, grafana_api_key):
|
|||||||
if p is not None:
|
if p is not None:
|
||||||
p.kill()
|
p.kill()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e.message)
|
print(str(e))
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
@ -1308,7 +1308,7 @@ def deleteDB(influx_info, grafana_port, grafana_api_key):
|
|||||||
if p is not None:
|
if p is not None:
|
||||||
p.kill()
|
p.kill()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e.message)
|
print(str(e))
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ def convertTime(file, node, start, lc, utcTime):
|
|||||||
epoch = int(time.mktime(time.strptime(utcTime[:23], pattern)))
|
epoch = int(time.mktime(time.strptime(utcTime[:23], pattern)))
|
||||||
return str(epoch)
|
return str(epoch)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
appendToFile("/tmp/csv-to-influx.log", "Error: Issue converting time for {} for {}. Please check the csv and re-parse as some data may be incorrect\n-{}".format(file, node, e.message))
|
appendToFile("/tmp/csv-to-influx.log", "Error: Issue converting time for {} for {}. Please check the csv and re-parse as some data may be incorrect\n-{}".format(file, node, str(e)))
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
@ -320,7 +320,7 @@ def parse(path, file, node, options, influx_info):
|
|||||||
"{} lines parsed in {} for {}".format(line_count, file_name, node))
|
"{} lines parsed in {} for {}".format(line_count, file_name, node))
|
||||||
break
|
break
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
appendToFile("/tmp/csv-to-influx.log", "Error: Issue opening {}\n-{}".format(file_loc, e.message))
|
appendToFile("/tmp/csv-to-influx.log", "Error: Issue opening {}\n-{}".format(file_loc, str(e)))
|
||||||
except (KeyboardInterrupt, SystemExit):
|
except (KeyboardInterrupt, SystemExit):
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
else:
|
else:
|
||||||
@ -363,7 +363,7 @@ def generateString(file, node, meas, tag_n, tag_v, field_n, field_v, lc, date):
|
|||||||
return None
|
return None
|
||||||
return base + '\n'
|
return base + '\n'
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
appendToFile("/tmp/csv-to-influx.log", "Error: Issue with http api string with {} for {}\n-{}".format(file, node, e.message))
|
appendToFile("/tmp/csv-to-influx.log", "Error: Issue with http api string with {} for {}\n-{}".format(file, node, str(e)))
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
3
tox.ini
3
tox.ini
@ -84,7 +84,6 @@ commands =
|
|||||||
# B001 Do not use bare `except:
|
# B001 Do not use bare `except:
|
||||||
# B007 Loop control variable 'cpu' not used within the loop body.
|
# B007 Loop control variable 'cpu' not used within the loop body.
|
||||||
# B301 Python 3 does not include `.iter*` methods on dictionaries.
|
# B301 Python 3 does not include `.iter*` methods on dictionaries.
|
||||||
# B306 `BaseException.message` has been deprecated as of Python 2.6 and is removed in Python 3.
|
|
||||||
# F series
|
# F series
|
||||||
# F401 'module' imported but unused
|
# F401 'module' imported but unused
|
||||||
# F841 local variable '_alarm_state' is assigned to but never used
|
# F841 local variable '_alarm_state' is assigned to but never used
|
||||||
@ -92,7 +91,7 @@ ignore = E121,E123,E124,E125,E126,E127,E128,E201,E202,E203,E211,E221,E222,E225,E
|
|||||||
E302,E303,E305,E402,E501,E722,E741,
|
E302,E303,E305,E402,E501,E722,E741,
|
||||||
H101,H102,H104,H201,H238,H237,H306,H401,H404,H405,
|
H101,H102,H104,H201,H238,H237,H306,H401,H404,H405,
|
||||||
W191,W291,W391,W503,
|
W191,W291,W391,W503,
|
||||||
B001,B007,B301,B306,
|
B001,B007,B301,
|
||||||
F401,F841
|
F401,F841
|
||||||
|
|
||||||
[testenv:pep8]
|
[testenv:pep8]
|
||||||
|
Loading…
Reference in New Issue
Block a user