Browse Source

Addressed more pylint issues

Change-Id: I888d8b4725e07753e608739ee09bde582184c473
changes/05/780605/2
Sorin Sbarnea 5 months ago
parent
commit
08902597bc
  1. 4
      .pre-commit-config.yaml
  2. 4
      .pylintrc
  3. 48
      tripleo_common/image/builder/buildah.py
  4. 4
      tripleo_common/image/image_uploader.py

4
.pre-commit-config.yaml

@ -12,7 +12,7 @@ repos:
- id: check-yaml
files: .*\.(yaml|yml)$
- repo: https://gitlab.com/pycqa/flake8.git
rev: 3.8.4
rev: 3.9.0
hooks:
- id: flake8
- repo: https://github.com/openstack-dev/bashate.git
@ -28,6 +28,6 @@ repos:
# use jinja templating, this will often fail and the syntax
# error will be discovered in execution anyway)
- repo: https://github.com/PyCQA/pylint
rev: pylint-2.6.0
rev: pylint-2.7.2
hooks:
- id: pylint

4
.pylintrc

@ -17,7 +17,6 @@ disable =
import-error,
inconsistent-return-statements,
invalid-name,
lost-exception,
missing-class-docstring,
missing-function-docstring,
missing-module-docstring,
@ -28,7 +27,6 @@ disable =
redefined-argument-from-local,
redefined-builtin,
redefined-outer-name,
simplifiable-if-statement,
super-init-not-called,
super-with-arguments,
superfluous-parens,
@ -42,14 +40,12 @@ disable =
too-many-nested-blocks,
too-many-public-methods,
too-many-statements,
try-except-raise,
unidiomatic-typecheck,
unnecessary-comprehension,
unnecessary-pass,
unsubscriptable-object,
unused-argument,
unused-variable,
useless-else-on-loop,
useless-object-inheritance,
useless-super-delegation,
wrong-import-order,

48
tripleo_common/image/builder/buildah.py

@ -354,31 +354,31 @@ class BuildahBuilder(base.BaseBuilder):
exception=job._exception
)
)
else:
if exceptions:
raise RuntimeError(
'\nThe following errors were detected during '
'container build(s):\n{exceptions}'.format(
exceptions='\n'.join(exceptions)
)
if exceptions:
raise RuntimeError(
'\nThe following errors were detected during '
'container build(s):\n{exceptions}'.format(
exceptions='\n'.join(exceptions)
)
)
if not_done:
error_msg = (
'The following jobs were incomplete: {}'.format(
[future_to_build[job] for job in not_done]
)
if not_done:
error_msg = (
'The following jobs were incomplete: {}'.format(
[future_to_build[job] for job in not_done]
)
)
jobs_with_exceptions = [{
'container': future_to_build[job],
'exception': job._exception}
for job in not_done if job._exception]
if jobs_with_exceptions:
for job_with_exception in jobs_with_exceptions:
error_msg = error_msg + os.linesep + (
"%(container)s raised the following "
"exception: %(exception)s" %
job_with_exception)
raise SystemError(error_msg)
jobs_with_exceptions = [{
'container': future_to_build[job],
'exception': job._exception}
for job in not_done if job._exception]
if jobs_with_exceptions:
for job_with_exception in jobs_with_exceptions:
error_msg = error_msg + os.linesep + (
"%(container)s raised the following "
"exception: %(exception)s" %
job_with_exception)
raise SystemError(error_msg)

4
tripleo_common/image/image_uploader.py

@ -1980,8 +1980,6 @@ class PythonImageUploader(BaseImageUploader):
LOG.error('[%s] Failed processing layer for the target '
'image %s' % (layer, target_url.geturl()))
raise
except Exception:
raise
else:
if layer_val and known_path:
image_ref = target_url.path.split(':')[0][1:]
@ -2343,8 +2341,6 @@ class PythonImageUploader(BaseImageUploader):
LOG.error('[%s] Failed processing layer for the target '
'image %s' % (layer['digest'], target_url.geturl()))
raise
except Exception:
raise
else:
if layer_val and known_path:
image_ref = target_url.path.split(':')[0][1:]

Loading…
Cancel
Save