Fix recent pep8 issues

The latest version of pycodestyle got stricter with undefined objects
pulled in via * imports. It's a nice check and actually found a bug, so
instead of disabling it, fix the places where we're using a * import.

W503 on the other hand is terrible.

Change-Id: Id73599ca494545b0f6d2345236190fc13cf2a326
This commit is contained in:
Monty Taylor 2018-05-12 10:31:30 -05:00
parent 2b48637b67
commit dcbcfbf124
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
4 changed files with 302 additions and 286 deletions

View File

@ -20,7 +20,9 @@ from openstack.config import loader
import pbr.version
import requestsexceptions
# The star import is for backwards compat reasons
from shade.exc import * # noqa
from shade import exc
from shade.openstackcloud import OpenStackCloud
from shade.operatorcloud import OperatorCloud
from shade import _log
@ -95,7 +97,7 @@ def openstack_clouds(
if f.name == cloud
]
except keystoneauth1.exceptions.auth_plugins.NoMatchingPlugin as e:
raise OpenStackCloudException(
raise exc.OpenStackCloudException(
"Invalid cloud configuration: {exc}".format(exc=str(e)))
@ -107,7 +109,7 @@ def openstack_cloud(
try:
cloud_config = config.get_one_cloud(**kwargs)
except keystoneauth1.exceptions.auth_plugins.NoMatchingPlugin as e:
raise OpenStackCloudException(
raise exc.OpenStackCloudException(
"Invalid cloud configuration: {exc}".format(exc=str(e)))
return OpenStackCloud(
cloud_config=cloud_config, strict=strict,
@ -122,7 +124,7 @@ def operator_cloud(
try:
cloud_config = config.get_one_cloud(**kwargs)
except keystoneauth1.exceptions.auth_plugins.NoMatchingPlugin as e:
raise OpenStackCloudException(
raise exc.OpenStackCloudException(
"Invalid cloud configuration: {exc}".format(exc=str(e)))
return OperatorCloud(
cloud_config=cloud_config, strict=strict,

View File

@ -44,11 +44,17 @@ def poll_for_events(
cloud, stack_name, action=None, poll_period=5, marker=None):
"""Continuously poll events and logs for performed action on stack."""
if action:
def stop_check_action(a):
stop_status = ('%s_FAILED' % action, '%s_COMPLETE' % action)
stop_check = lambda a: a in stop_status
return a in stop_status
def stop_check_no_action(a):
return a.endswith('_COMPLETE') or a.endswith('_FAILED')
if action:
stop_check = stop_check_action
else:
stop_check = lambda a: a.endswith('_COMPLETE') or a.endswith('_FAILED')
stop_check = stop_check_no_action
no_event_polls = 0
msg_template = "\n Stack %(name)s %(status)s \n"

File diff suppressed because it is too large Load Diff

View File

@ -88,7 +88,9 @@ commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasen
# single vs double quotes in the license text. Fixing is not worth it
# H306 Is about alphabetical imports - there's a lot to fix
# H4 Are about docstrings - and there's just too many of them to fix
ignore = H103,H306,H4
# W503 Is supposed to be off by default but a bug has it on by default. It's
# also a categorially terrible idea and Donald Knuth agrees with me.
ignore = H103,H306,H4,W503
show-source = True
builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build