fix: Gate fix for Shipyard docs and pep8 gates

Now that the Shipyard gates are running on Focal(20.04), flake8, grpcio,
and pyflakes need to use a version compatible with python3.8 and Ubuntu
20.04 which is the default python version in Ubuntu focal. Also unpinning
setuptools so that it is compatible with python3.8.

Additionally, address pep8 violations that arise from using a newer
version of flake8

Change-Id: Idc3c5d66b48fc9e4497a71d1b640bcd2872c22eb
This commit is contained in:
Rick Bartra 2020-09-01 13:40:08 -04:00 committed by Rick Bartra
parent a5e57879ab
commit d38078cce3
10 changed files with 25 additions and 13 deletions

View File

@ -21,6 +21,7 @@ configparser==3.5.0
cryptography==2.3 cryptography==2.3
falcon==1.4.1 falcon==1.4.1
jsonschema==2.6.0 jsonschema==2.6.0
grpcio>=1.16.0
keystoneauth1==3.11.0 keystoneauth1==3.11.0
keystonemiddleware==5.2.0 keystonemiddleware==5.2.0
networkx==2.1 # common/deployment_group networkx==2.1 # common/deployment_group
@ -31,7 +32,6 @@ psycopg2-binary==2.8.4
python-dateutil==2.7.3 python-dateutil==2.7.3
python-memcached==1.59 python-memcached==1.59
requests==2.20.0 requests==2.20.0
setuptools==40.4.1
SQLAlchemy==1.3.15 SQLAlchemy==1.3.15
ulid==1.1 ulid==1.1
uwsgi~=2.0.19.1 uwsgi~=2.0.19.1

View File

@ -1,4 +1,5 @@
# Testing # Testing
pyflakes>=2.1.1
amqp~=2.6.0 amqp~=2.6.0
pytest==3.5.0 pytest==3.5.0
pytest-cov==2.5.1 pytest-cov==2.5.1
@ -11,7 +12,7 @@ apache-airflow[crypto,celery,postgres,hive,hdfs,jdbc]==1.10.1
git+https://opendev.org/airship/promenade.git@master#egg=promenade git+https://opendev.org/airship/promenade.git@master#egg=promenade
# Linting # Linting
flake8==3.3.0 flake8>=3.3.0
# Security scanning # Security scanning
bandit>=1.5.0 # Apache-2.0 bandit>=1.5.0 # Apache-2.0

View File

@ -36,7 +36,7 @@ commands =
[testenv:pep8] [testenv:pep8]
basepython=python3 basepython=python3
deps= deps=
flake8==3.3.0 flake8>=3.3.0
bandit>=1.5.0 bandit>=1.5.0
commands = commands =
flake8 {toxinidir}/shipyard_airflow flake8 {toxinidir}/shipyard_airflow
@ -76,7 +76,9 @@ filename = *.py
# cases need to be un-ignored and fixed up. These are ignored because of # cases need to be un-ignored and fixed up. These are ignored because of
# the method in which test requirements bring in the hacking rules from # the method in which test requirements bring in the hacking rules from
# other projects. # other projects.
ignore = F841, H101, H201, H210, H238, H301, H304, H306, H401, H403, H404, H405 # W504 line break after binary operator
# TODO(rb560u): Address E722 violations
ignore = F841, H101, H201, H210, H238, H301, H304, H306, H401, H403, H404, H405, W504, E722
# NOTE(Bryan Strassner) excluding 3rd party and generated code that is brought into the # NOTE(Bryan Strassner) excluding 3rd party and generated code that is brought into the
# codebase. # codebase.
exclude = .venv,.git,.tox,build,dist,*lib/python*,*egg,alembic/env.py,docs exclude = .venv,.git,.tox,build,dist,*lib/python*,*egg,alembic/env.py,docs

View File

@ -145,7 +145,8 @@ class BaseClient(metaclass=abc.ABCMeta):
if token: if token:
return token return token
else: else:
return self._get_ks_session().get_auth_headers().get('X-Auth-Token') return self._get_ks_session().get_auth_headers().\
get('X-Auth-Token')
def _get_ks_session(self): def _get_ks_session(self):
self.logger.debug('Accessing keystone for keystone session') self.logger.debug('Accessing keystone for keystone session')

View File

@ -66,7 +66,7 @@ SHORT_DESC_ACTION = (
def create_action(ctx, action_name, param, allow_intermediate_commits=False): def create_action(ctx, action_name, param, allow_intermediate_commits=False):
check_action_command(ctx, action_name) check_action_command(ctx, action_name)
if not param and action_name is 'redeploy_server': if not param and action_name == 'redeploy_server':
ctx.fail('At least one parameter must be specified using ' ctx.fail('At least one parameter must be specified using '
'--param="<parameter>" with action redeploy_server') '--param="<parameter>" with action redeploy_server')
else: else:

View File

@ -120,7 +120,8 @@ SHORT_DESC_NOTEDETAILS = (
"Retrieves the detailed information about the supplied action id.") "Retrieves the detailed information about the supplied action id.")
@describe.command('notedetails', @describe.command(
'notedetails',
help=DESC_NOTEDETAILS, short_help=SHORT_DESC_NOTEDETAILS) help=DESC_NOTEDETAILS, short_help=SHORT_DESC_NOTEDETAILS)
@click.argument('note_id') @click.argument('note_id')
@click.pass_context @click.pass_context

View File

@ -62,6 +62,7 @@ def cli_format_status_handler(response, is_error=False):
return "Error: Unable to decode response. Value: {}".format( return "Error: Unable to decode response. Value: {}".format(
response.text) response.text)
def cli_format_exception_handler(exc_msg): def cli_format_exception_handler(exc_msg):
""" Formatter for custom error raised by Shipyard """ """ Formatter for custom error raised by Shipyard """
try: try:
@ -73,6 +74,7 @@ def cli_format_exception_handler(exc_msg):
return "Error: Unable to decode response. Value: {}".format( return "Error: Unable to decode response. Value: {}".format(
exc_msg) exc_msg)
def cli_format_response(formatted, response): def cli_format_response(formatted, response):
""" Handler for Shipyard status and error responses """ Handler for Shipyard status and error responses

View File

@ -180,8 +180,10 @@ def get_renderedconfigdocs(ctx, buffer, committed, last_site_action,
_version = get_version(ctx, buffer, committed, last_site_action, _version = get_version(ctx, buffer, committed, last_site_action,
successful_site_action) successful_site_action)
click.echo(GetRenderedConfigdocs(ctx, _version, click.echo(GetRenderedConfigdocs(
cleartext_secrets).invoke_and_return_resp()) ctx,
_version,
cleartext_secrets).invoke_and_return_resp())
DESC_WORKFLOWS = """ DESC_WORKFLOWS = """

View File

@ -1,4 +1,5 @@
# Testing # Testing
pyflakes>=2.1.1
amqp~=2.6.0 amqp~=2.6.0
pytest==3.5.0 pytest==3.5.0
pytest-cov==2.5.1 pytest-cov==2.5.1
@ -6,7 +7,7 @@ responses==0.10.2
testfixtures==5.1.1 testfixtures==5.1.1
# Linting # Linting
flake8==3.3.0 flake8>=3.3.0
# Security scanning # Security scanning
bandit>=1.1.0 # Apache-2.0 bandit>=1.1.0 # Apache-2.0

View File

@ -33,10 +33,10 @@ commands =
[testenv:pep8] [testenv:pep8]
basepython=python3 basepython=python3
deps= deps=
flake8==3.3.0 flake8>=3.3.0
bandit>=1.5.0 bandit>=1.5.0
commands = commands =
flake8 {toxinidir}/shipyard_airflow flake8 {toxinidir}/shipyard_client
bandit -r shipyard_airflow bandit -r shipyard_airflow
[testenv:bandit] [testenv:bandit]
@ -47,5 +47,7 @@ commands =
[flake8] [flake8]
filename = *.py filename = *.py
ignore = F841 # W504 line break after binary operator
# TODO(rb560u): Address E722 violations
ignore = F841,W504,E722
exclude = .venv,.git,.tox,build,dist,*lib/python*,*egg,docs exclude = .venv,.git,.tox,build,dist,*lib/python*,*egg,docs