Update hacking for Python3
The repo is Python 3 now, so update hacking to version 3.0 which supports Python 3. Fix problems found. Update local hacking checks for new flake8. Remove hacking and friends from lower-constraints, they are not needed to be installed at run-time. Move hacking tests to another subdir, import hacking failed since the subdir was called hacking as well. Change-Id: I684f0e4be28e529ae2c9d6f4bef5bd840adc8787
This commit is contained in:
parent
eb5cef0bf5
commit
0b8d264171
|
@ -49,5 +49,6 @@ def main():
|
|||
return upgradecheck.main(
|
||||
cfg.CONF, project='blazar', upgrade_command=Checks())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
|
|
|
@ -78,6 +78,7 @@ def run_migrations_online(config):
|
|||
finally:
|
||||
connection.close()
|
||||
|
||||
|
||||
if context.is_offline_mode():
|
||||
run_migrations_offline(config.blazar_config)
|
||||
else:
|
||||
|
|
|
@ -48,4 +48,5 @@ def datetime_to_str(dct, attr_name):
|
|||
if dct.get(attr_name) is not None:
|
||||
dct[attr_name] = dct[attr_name].isoformat(' ')
|
||||
|
||||
|
||||
BlazarBase = declarative.declarative_base(cls=_BlazarBase)
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
import re
|
||||
|
||||
from hacking import core
|
||||
|
||||
_all_log_levels = {'critical', 'error', 'exception', 'info',
|
||||
'warning', 'debug'}
|
||||
|
@ -28,6 +29,7 @@ _log_translation_hint = re.compile(
|
|||
})
|
||||
|
||||
|
||||
@core.flake8ext
|
||||
def no_translate_logs(logical_line):
|
||||
"""C312 - Don't translate logs.
|
||||
|
||||
|
@ -45,7 +47,3 @@ def no_translate_logs(logical_line):
|
|||
"""
|
||||
if _log_translation_hint.match(logical_line):
|
||||
yield (0, "C312: Log messages should not be translated!")
|
||||
|
||||
|
||||
def factory(register):
|
||||
register(no_translate_logs)
|
||||
|
|
|
@ -195,7 +195,7 @@ class PhysicalHostPlugin(base.BasePlugin, nova.NovaClientWrapper):
|
|||
host_reservation['aggregate_id']):
|
||||
for server in client.servers.list(
|
||||
search_opts={"host": host, "all_tenants": 1}):
|
||||
client.servers.create_image(server=server)
|
||||
client.servers.create_image(server=server)
|
||||
|
||||
def on_end(self, resource_id):
|
||||
"""Remove the hosts from the pool."""
|
||||
|
|
|
@ -194,18 +194,18 @@ class LeaseStatus(BaseStatus):
|
|||
def wrapper(*args, **kwargs):
|
||||
# Update a lease status
|
||||
lease_id = kwargs['lease_id']
|
||||
l = db_api.lease_get(lease_id)
|
||||
if cls.is_valid_transition(l['status'],
|
||||
lease = db_api.lease_get(lease_id)
|
||||
if cls.is_valid_transition(lease['status'],
|
||||
transition,
|
||||
lease_id=lease_id):
|
||||
db_api.lease_update(lease_id,
|
||||
{'status': transition})
|
||||
LOG.debug('Status of lease %s changed from %s to %s.',
|
||||
lease_id, l['status'], transition)
|
||||
lease_id, lease['status'], transition)
|
||||
else:
|
||||
LOG.warn('Aborting %s. '
|
||||
'Invalid lease status transition from %s to %s.',
|
||||
func.__name__, l['status'],
|
||||
func.__name__, lease['status'],
|
||||
transition)
|
||||
raise exceptions.InvalidStatus
|
||||
|
||||
|
|
|
@ -22,11 +22,9 @@ eventlet==0.18.2
|
|||
extras==1.0.0
|
||||
fasteners==0.14.1
|
||||
fixtures==3.0.0
|
||||
flake8==2.5.5
|
||||
Flask==0.10
|
||||
futurist==1.6.0
|
||||
greenlet==0.4.13
|
||||
hacking==0.12.0
|
||||
idna==2.6
|
||||
imagesize==1.0.0
|
||||
iso8601==0.1.11
|
||||
|
@ -70,12 +68,10 @@ Paste==2.0.3
|
|||
PasteDeploy==1.5.2
|
||||
pbr==2.0.0
|
||||
pecan==1.0.0
|
||||
pep8==1.5.7
|
||||
pika-pool==0.1.3
|
||||
pika==0.10.0
|
||||
prettytable==0.7.2
|
||||
pycadf==2.7.0
|
||||
pyflakes==0.8.1
|
||||
Pygments==2.2.0
|
||||
pyinotify==0.9.6
|
||||
pylint==1.9.1
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# The order of packages is significant, because pip processes them in the order
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
|
||||
hacking>=3.0,<3.1.0 # Apache-2.0
|
||||
|
||||
ddt>=1.0.1 # MIT
|
||||
mock>=2.0.0 # BSD
|
||||
|
|
15
tox.ini
15
tox.ini
|
@ -61,17 +61,22 @@ commands = oslo-config-generator --config-file=etc/blazar/blazar-config-generato
|
|||
show-source = true
|
||||
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,tools,api-ref
|
||||
# NOTE(tonyb): Ignore a few errors/warnings that are now "on by default".
|
||||
ignore=H105,H238,E123
|
||||
# W503 line break before binary operator
|
||||
# W504 line break after binary operator
|
||||
# E402 module level import not at top of file
|
||||
ignore=H105,H238,E123,E402,W503,W504
|
||||
# [H904] Delay string interpolations at logging calls.
|
||||
enable-extensions=H904
|
||||
# To get a list of functions that have a complexity of 17 or more, set
|
||||
# max-complexity to 17 and run 'tox -epep8'.
|
||||
# 16 is currently the most complex thing we have:
|
||||
# 23 is currently the most complex thing we have:
|
||||
# 'ManagerService.update_lease' - blazar/manager/service.py
|
||||
max-complexity=17
|
||||
max-complexity=23
|
||||
|
||||
[hacking]
|
||||
local-check-factory = blazar.hacking.checks.factory
|
||||
[flake8:local-plugins]
|
||||
extension =
|
||||
C312 = checks:no_translate_logs
|
||||
paths = ./blazar/hacking
|
||||
|
||||
[testenv:pylint]
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
|
|
Loading…
Reference in New Issue