From 4d309d8e542d81e15e6ce669791a7ded5970182e Mon Sep 17 00:00:00 2001 From: Gael Chamoulaud Date: Tue, 30 Jul 2019 11:35:05 +0200 Subject: [PATCH] Linting hardening with pre-commit - Adds bashate test using v0.6.0 - Bump pre-commit-hooks release to v2.2.4 - Bump ansible-lint release to v4.1.0a0 - Fix some minor flake8 errors Change-Id: I66b796fab1d8651163226febbc4e99648a9ecc6a Signed-off-by: Gael Chamoulaud (cherry picked from commit cac3e7101d89c743ce2593141b9da4735be2fd33) --- .pre-commit-config.yaml | 22 ++- bindep.txt | 33 ++++ doc/requirements.txt | 7 + doc/source/_exts/generate_validations_doc.py | 13 +- doc/source/conf.py | 3 +- doc/source/index.rst | 4 +- doc/source/readme.rst | 16 +- .../roles/role-check-latest-minor-version.rst | 7 - .../role-check-latest-packages-version.rst | 6 + library/check_ironic_boot_config.py | 2 + library/docker_facts.py | 8 +- library/haproxy_conf.py | 6 +- library/ini.py | 1 + lookup_plugins/ironic_nodes.py | 8 +- lookup_plugins/nova_servers.py | 11 +- molecule-requirements.txt | 10 ++ playbooks/nova-status.yaml | 6 +- playbooks/openshift-hw-requirements.yaml | 13 +- playbooks/openshift-nw-requirements.yaml | 2 +- playbooks/stack-health.yaml | 2 +- ...ge-validation-result-daddc8c015dd34c0.yaml | 2 +- .../tasks/openshift-hw-requirements.yaml | 10 +- test-requirements.txt | 1 + tools/releasenotes_tox.sh | 3 +- tools/validate-files.py | 1 + tox.ini | 160 ++++++++++++------ validations/library/docker_facts.py | 8 +- validations/library/ini.py | 1 + validations/lookup_plugins/ironic_nodes.py | 7 +- validations/lookup_plugins/nova_servers.py | 10 +- zuul.d/layout.yaml | 33 ++-- 31 files changed, 273 insertions(+), 143 deletions(-) create mode 100644 bindep.txt create mode 100644 doc/requirements.txt delete mode 100644 doc/source/roles/role-check-latest-minor-version.rst create mode 100644 doc/source/roles/role-check-latest-packages-version.rst create mode 100644 molecule-requirements.txt diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e705344c2..efaa5f025 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,8 +1,9 @@ --- repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.0.0 + rev: v2.1.0 hooks: + - id: end-of-file-fixer - id: trailing-whitespace - id: mixed-line-ending - id: check-byte-order-marker @@ -10,20 +11,31 @@ repos: - id: check-merge-conflict - id: debug-statements - id: flake8 - additional_dependencies: - - hacking<1.2.0,>=1.1.0 + entry: flake8 --ignore=E123,E125,W503,W504,W605 - id: check-yaml files: .*\.(yaml|yml)$ - repo: https://github.com/adrienverge/yamllint.git - rev: v1.13.0 + rev: v1.15.0 hooks: - id: yamllint files: \.(yaml|yml)$ types: [file, yaml] entry: yamllint --strict -f parsable - repo: https://github.com/ansible/ansible-lint - rev: v4.1.0 + rev: v4.1.0a0 hooks: - id: ansible-lint files: \.(yaml|yml)$ entry: ansible-lint --force-color -v + - repo: https://github.com/openstack-dev/bashate.git + rev: 0.6.0 + hooks: + - id: bashate + entry: bashate --error . --verbose --ignore=E006,E040 + # Run bashate check for all bash scripts + # Ignores the following rules: + # E006: Line longer than 79 columns (as many scripts use jinja + # templating, this is very difficult) + # E040: Syntax error determined using `bash -n` (as many scripts + # use jinja templating, this will often fail and the syntax + # error will be discovered in execution anyway) diff --git a/bindep.txt b/bindep.txt new file mode 100644 index 000000000..cd16325d4 --- /dev/null +++ b/bindep.txt @@ -0,0 +1,33 @@ +# This file facilitates OpenStack-CI package installation +# before the execution of any tests. +# +# See the following for details: +# - https://docs.openstack.org/infra/bindep/ +# - https://opendev.org/opendev/bindep/ +# +# Even if the role does not make use of this facility, it +# is better to have this file empty, otherwise OpenStack-CI +# will fall back to installing its default packages which +# will potentially be detrimental to the tests executed. + +# The gcc compiler +gcc + +# Base requirements for RPM distros +gcc-c++ [platform:rpm] +git [platform:rpm] +libffi-devel [platform:rpm] +openssl-devel [platform:rpm] +python-devel [platform:rpm] +python2-dnf [platform:fedora] +python-virtualenv [platform:rpm] + +# For SELinux +libselinux-python [platform:rpm] +libsemanage-python [platform:redhat] + +# Required for compressing collected log files in CI +gzip + +# Required to build language docs +gettext diff --git a/doc/requirements.txt b/doc/requirements.txt new file mode 100644 index 000000000..ff27c1f58 --- /dev/null +++ b/doc/requirements.txt @@ -0,0 +1,7 @@ +# this is required for the docs build jobs +sphinx!=1.6.6,!=1.6.7,>=1.6.2,<2.0.0;python_version=='2.7' # BSD +sphinx!=1.6.6,!=1.6.7,>=1.6.2;python_version>='3.4' # BSD +openstackdocstheme>=1.18.1 # Apache-2.0 +reno>=2.11.3 # Apache-2.0 +doc8>=0.8.0 # Apache-2.0 +bashate>=0.6.0 # Apache-2.0 diff --git a/doc/source/_exts/generate_validations_doc.py b/doc/source/_exts/generate_validations_doc.py index db6423891..43273bc19 100644 --- a/doc/source/_exts/generate_validations_doc.py +++ b/doc/source/_exts/generate_validations_doc.py @@ -58,10 +58,14 @@ def get_validation_parameters(validation): def build_summary(group, validations): - entries = ["* :ref:`{}`: {}".format(group + '_' + validation['id'], validation['name']) - for validation in validations] + entries = [ + "* :ref:`{}`: {}".format(group + '_' + validation['id'], + validation['name']) + for validation in validations + ] with open('doc/source/validations-{}.rst'.format(group), 'w') as f: f.write("\n".join(entries)) + f.write("\n") def format_dict(my_dict): @@ -83,10 +87,11 @@ def build_detail(group, validations): - **hosts**: {hosts} - **groups**: {groups} -- **metadata**: {metadata} -- **parameters**: {parameters} +- **parameters**:{parameters} - **roles**: {roles} +Role documentation + .. toctree:: roles/role-{roles} diff --git a/doc/source/conf.py b/doc/source/conf.py index 825d0da8a..492d08ec9 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python # -*- coding: utf-8 -*- # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -26,7 +27,7 @@ sys.path.insert(0, os.path.join(os.path.abspath('.'), '_exts')) # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [ 'sphinx.ext.autodoc', - #'sphinx.ext.intersphinx', + # 'sphinx.ext.intersphinx', 'generate_validations_doc', 'ansible-autodoc', 'openstackdocstheme' diff --git a/doc/source/index.rst b/doc/source/index.rst index 4f04afa29..18aad0c27 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -4,7 +4,7 @@ contain the root `toctree` directive. Welcome to tripleo-validations's documentation! -======================================================== +=============================================== Contents: @@ -13,7 +13,6 @@ Contents: readme installation - usage contributing roles modules @@ -38,4 +37,3 @@ Indices and tables * :ref:`genindex` * :ref:`search` - diff --git a/doc/source/readme.rst b/doc/source/readme.rst index cb3f4b6f5..b2f282856 100644 --- a/doc/source/readme.rst +++ b/doc/source/readme.rst @@ -69,7 +69,7 @@ introspection. Pre Deployment ~~~~~~~~~~~~~~ -Validation that are run right before deploying the overcloud. +Validations that are run right before deploying the overcloud. .. include:: validations-pre-deployment.rst @@ -94,6 +94,20 @@ Validations that are run right before a major upgrade of the undercloud or overc .. include:: validations-pre-upgrade.rst +Post Upgrade +~~~~~~~~~~~~ + +Validations that are run right after a major upgrade of the undercloud or overcloud. + +.. include:: validations-post-upgrade.rst + +OpenShift On OpenStack +~~~~~~~~~~~~~~~~~~~~~~ + +Validations that are run right after the undercloud is installed. + +.. include:: validations-openshift-on-openstack.rst + Writing Validations ------------------- diff --git a/doc/source/roles/role-check-latest-minor-version.rst b/doc/source/roles/role-check-latest-minor-version.rst deleted file mode 100644 index b671b56b3..000000000 --- a/doc/source/roles/role-check-latest-minor-version.rst +++ /dev/null @@ -1,7 +0,0 @@ -========================== -check-latest-minor-version -========================== - -.. ansibleautoplugin:: - :role: roles/check-latest-minor-version - diff --git a/doc/source/roles/role-check-latest-packages-version.rst b/doc/source/roles/role-check-latest-packages-version.rst new file mode 100644 index 000000000..4dcf7f8d9 --- /dev/null +++ b/doc/source/roles/role-check-latest-packages-version.rst @@ -0,0 +1,6 @@ +============================= +check-latest-packages-version +============================= + +.. ansibleautoplugin:: + :role: roles/check-latest-packages-version diff --git a/library/check_ironic_boot_config.py b/library/check_ironic_boot_config.py index 05672c74a..85e53db4b 100644 --- a/library/check_ironic_boot_config.py +++ b/library/check_ironic_boot_config.py @@ -84,6 +84,7 @@ def _all_possible_names(arch, platform, image_name_base): yield _name_helper(image_name_base, arch=arch) yield _name_helper(image_name_base) + MISMATCH = ( "\nNode {} has an incorrectly configured driver_info/deploy_{}. Expected " "{} but got {}." @@ -182,5 +183,6 @@ def main(): else: module.exit_json() + if __name__ == '__main__': main() diff --git a/library/docker_facts.py b/library/docker_facts.py index a2bd4cbd5..e675ce69c 100644 --- a/library/docker_facts.py +++ b/library/docker_facts.py @@ -17,6 +17,10 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function +import itertools + +from ansible.module_utils.basic import AnsibleModule + import six six.add_metaclass(type) @@ -114,10 +118,6 @@ docker: type: list """ -import itertools - -from ansible.module_utils.basic import AnsibleModule - DOCKER_SUBCOMMAND_LOOKUP = [ ('images', 'images', '-q'), ('volumes', 'volume ls', '-q'), diff --git a/library/haproxy_conf.py b/library/haproxy_conf.py index 8c091b8cb..df8b28340 100644 --- a/library/haproxy_conf.py +++ b/library/haproxy_conf.py @@ -56,14 +56,14 @@ def generic_ini_style_conf_parser(file_path, section_regex, option_regex): config[current_section] = {} match_option = re.match(option_regex, line) if match_option and current_section: - option = re.sub('\s+', ' ', match_option.group(1)) + option = re.sub(r'\s+', ' ', match_option.group(1)) config[current_section][option] = match_option.group(2) return config def parse_haproxy_conf(file_path): - section_regex = '^(\w+)' - option_regex = '^(?:\s+)(\w+(?:\s+\w+)*?)\s+([\w/]*)$' + section_regex = r'^(\w+)' + option_regex = r'^(?:\s+)(\w+(?:\s+\w+)*?)\s+([\w/]*)$' return generic_ini_style_conf_parser(file_path, section_regex, option_regex) diff --git a/library/ini.py b/library/ini.py index 86dfe4a42..debed94cc 100644 --- a/library/ini.py +++ b/library/ini.py @@ -79,6 +79,7 @@ def get_result(path, section, key): ret = ReturnValue.KEY_NOT_FOUND return (ret, msg, value) + DOCUMENTATION = ''' --- module: ini diff --git a/lookup_plugins/ironic_nodes.py b/lookup_plugins/ironic_nodes.py index 96362bfd0..b744e84c2 100644 --- a/lookup_plugins/ironic_nodes.py +++ b/lookup_plugins/ironic_nodes.py @@ -15,6 +15,10 @@ # License for the specific language governing permissions and limitations # under the License. +from ansible.plugins.lookup import LookupBase + +from tripleo_validations import utils + DOCUMENTATION = """ lookup: ironic_nodes description: Retrieve node information from Ironic @@ -65,10 +69,6 @@ _raw: description: A Python list with results from the API call. """ -from ansible.plugins.lookup import LookupBase - -from tripleo_validations import utils - class LookupModule(LookupBase): diff --git a/lookup_plugins/nova_servers.py b/lookup_plugins/nova_servers.py index 31507d9f1..647c0f2ad 100644 --- a/lookup_plugins/nova_servers.py +++ b/lookup_plugins/nova_servers.py @@ -15,6 +15,12 @@ # License for the specific language governing permissions and limitations # under the License. +from ansible.plugins.lookup import LookupBase +from novaclient.exceptions import NotFound + +from tripleo_validations import utils + + DOCUMENTATION = """ lookup: nova_servers description: Retrieve server information from Nova @@ -51,11 +57,6 @@ _raw: description: A Python list with results from the API call. """ -from ansible.plugins.lookup import LookupBase -from novaclient.exceptions import NotFound - -from tripleo_validations import utils - class LookupModule(LookupBase): diff --git a/molecule-requirements.txt b/molecule-requirements.txt new file mode 100644 index 000000000..36b47d7b6 --- /dev/null +++ b/molecule-requirements.txt @@ -0,0 +1,10 @@ +# this is required for the molecule jobs +ansible +ansi2html +docker +pytest +pytest-cov +pytest-html +pytest-xdist +mock +molecule>=2.22rc1 diff --git a/playbooks/nova-status.yaml b/playbooks/nova-status.yaml index 1204bbd7c..4093e63f7 100644 --- a/playbooks/nova-status.yaml +++ b/playbooks/nova-status.yaml @@ -14,10 +14,8 @@ The nova-status upgrade check command has three standard return codes: 0 -> All upgrade readiness checks passed successfully and there is nothing to do. - 1 -> At least one check encountered an issue and requires further investigation. - This is considered a warning but the upgrade may be OK. - 2 -> There was an upgrade status check failure that needs to be investigated. - This should be considered something that stops an upgrade. + 1 -> At least one check encountered an issue and requires further investigation. This is considered a warning but the upgrade may be OK. + 2 -> There was an upgrade status check failure that needs to be investigated. This should be considered something that stops an upgrade. groups: - pre-upgrade roles: diff --git a/playbooks/openshift-hw-requirements.yaml b/playbooks/openshift-hw-requirements.yaml index 58ba9798e..c9cfc0862 100644 --- a/playbooks/openshift-hw-requirements.yaml +++ b/playbooks/openshift-hw-requirements.yaml @@ -7,15 +7,10 @@ Check if there are enough resources for an OpenShift deployment on top of Openstack deployment: - - Is there a flavor that meets the minimum requirements for a test - environment? - (4GB RAM, 40GB disk) - - Is there a flavor that meets the minimum requirements for a - production environment? - (16GB RAM, 40GB disk, 4 VCPUs) + - Is there a flavor that meets the minimum requirements for a test environment? (4GB RAM, 40GB disk) + - Is there a flavor that meets the minimum requirements for a production environment? (16GB RAM, 40GB disk, 4 VCPUs) - Are images named centos or rhel available? - - Are there sufficient compute resources available for a default setup? - (1 Master node, 1 Infra node, 2 App nodes) + - Are there sufficient compute resources available for a default setup? (1 Master node, 1 Infra node, 2 App nodes) groups: - openshift-on-openstack min_total_ram_testing: 16384 # 4 per node @@ -33,4 +28,4 @@ tasks: - include_role: name: openshift-on-openstack - tasks_from: openshift-hw-requirements + tasks_from: openshift-hw-requirements.yaml diff --git a/playbooks/openshift-nw-requirements.yaml b/playbooks/openshift-nw-requirements.yaml index 5d10ef966..fb1e4f105 100644 --- a/playbooks/openshift-nw-requirements.yaml +++ b/playbooks/openshift-nw-requirements.yaml @@ -11,4 +11,4 @@ tasks: - include_role: name: openshift-on-openstack - tasks_from: openshift-nw-requirements + tasks_from: openshift-nw-requirements.yaml diff --git a/playbooks/stack-health.yaml b/playbooks/stack-health.yaml index 790741f78..f3fe393ea 100644 --- a/playbooks/stack-health.yaml +++ b/playbooks/stack-health.yaml @@ -4,7 +4,7 @@ metadata: name: Stack Health Check description: > - Check if all stack resources are in a *_COMPLETE state before starting + Check if all stack resources are in a 'COMPLETE' state before starting an upgrade. groups: - pre-upgrade diff --git a/releasenotes/notes/ip-range-validation-result-daddc8c015dd34c0.yaml b/releasenotes/notes/ip-range-validation-result-daddc8c015dd34c0.yaml index 58a6a6b63..455aba7b8 100644 --- a/releasenotes/notes/ip-range-validation-result-daddc8c015dd34c0.yaml +++ b/releasenotes/notes/ip-range-validation-result-daddc8c015dd34c0.yaml @@ -2,5 +2,5 @@ fixes: - | Instead of only outputting a warning, the IP range validation now fails if - the number of available addresses is lower than the recommended minimum. + the number of available addresses is lower than the recommended minimum. (Fixes https://bugs.launchpad.net/tripleo/+bug/1713483) diff --git a/roles/openshift-on-openstack/tasks/openshift-hw-requirements.yaml b/roles/openshift-on-openstack/tasks/openshift-hw-requirements.yaml index 0fc442c7f..05ba8fc60 100644 --- a/roles/openshift-on-openstack/tasks/openshift-hw-requirements.yaml +++ b/roles/openshift-on-openstack/tasks/openshift-hw-requirements.yaml @@ -132,14 +132,16 @@ warning_msg: | {{ lookup('template', './templates/openshift-hw-requirements-warnings.j2') }} -- name: Fail if minimum requirements aren't met - fail: msg="{{ warning_msg }}" +- name: Fail if minimum requirements are not met + fail: + msg: "{{ warning_msg }}" when: not matching_flavors_testing or not matching_image or not resource_reqs_testing -- name: Warn if production requirements aren't met - warn: msg="{{ warning_msg }}" +- name: Warn if production requirements are not met + warn: + msg: "{{ warning_msg }}" when: not matching_flavors_prod or not matching_image or not resource_reqs_prod diff --git a/test-requirements.txt b/test-requirements.txt index 25a16ffcd..98d36ddbc 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -15,3 +15,4 @@ testscenarios>=0.4 # Apache-2.0/BSD testtools>=2.2.0 # MIT reno>=2.5.0 # Apache-2.0 netaddr>=0.7.18 # BSD +pre-commit # MIT diff --git a/tools/releasenotes_tox.sh b/tools/releasenotes_tox.sh index 4fecfd929..c37cf598e 100755 --- a/tools/releasenotes_tox.sh +++ b/tools/releasenotes_tox.sh @@ -11,8 +11,7 @@ BUILD_RESULT=$? UNCOMMITTED_NOTES=$(git status --porcelain | \ awk '$1 == "M" && $2 ~ /releasenotes\/notes/ {print $2}') -if [ "${UNCOMMITTED_NOTES}" ] -then +if [ "${UNCOMMITTED_NOTES}" ]; then cat <=2" "pre-commit>=1.10" -deps = -r{toxinidir}/test-requirements.txt + ANSIBLE_NOCOWS=1 + ANSIBLE_RETRY_FILES_ENABLED=0 + ANSIBLE_STDOUT_CALLBACK=debug + ANSIBLE_LOG_PATH={envlogdir}/ansible-execution.log + PY_COLORS=1 + VIRTUAL_ENV={envdir} + # pip: Avoid 2020-01-01 warnings: https://github.com/pypa/pip/issues/6207 + # paramiko CryptographyDeprecationWarning: https://github.com/ansible/ansible/issues/52598 + PYTHONWARNINGS=ignore:DEPRECATION::pip._internal.cli.base_command,ignore::UserWarning + PIP_DISABLE_PIP_VERSION_CHECK=1 commands = python setup.py test --slowest --testr-args='{posargs}' +sitepackages = True +deps = + -r {toxinidir}/requirements.txt + -r {toxinidir}/test-requirements.txt + -r {toxinidir}/molecule-requirements.txt whitelist_externals = bash tox -[testenv:releasenotes] -basepython = python3 -whitelist_externals = bash -commands = bash -c tools/releasenotes_tox.sh - -[testenv:pep8] -basepython = python3 -commands = - {[testenv:ansible-lint]commands} - flake8 {posargs} - python ./tools/validate-files.py . - -[testenv:venv] -basepython = python3 -commands = {posargs} - -[testenv:cover] -basepython = python3 -commands = python setup.py test --coverage --testr-args='{posargs}' - -[testenv:docs] -basepython = python3 -commands = python setup.py build_sphinx +[testenv:bindep] +# Do not install any requirements. We want this to be fast and work even if +# system dependencies are missing, since it's used to tell you what system +# dependencies are missing! This also means that bindep must be installed +# separately, outside of the requirements files. +deps = bindep +commands = bindep test [testenv:debug] basepython = python3 commands = oslo_debug_helper {posargs} +[testenv:pep8] +envdir = {toxworkdir}/linters +commands = + python -m pre_commit run flake8 -a + [testenv:ansible-lint] -basepython = python3 +envdir = {toxworkdir}/linters +deps = + {[testenv:linters]deps} commands = python -m pre_commit run ansible-lint -a -[flake8] -# E123, E125 skipped as they are invalid PEP-8. +[testenv:yamllint] +envdir = {toxworkdir}/linters +deps = {[testenv:linters]deps} +commands = + python -m pre_commit run yamllint -a -show-source = True -ignore = E123,E125 -builtins = _ -exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build +[testenv:bashate] +envdir = {toxworkdir}/linters +deps = {[testenv:linters]deps} +commands = + python -m pre_commit run bashate -a -[testenv:lower-constraints] +[testenv:whitespace] +envdir = {toxworkdir}/linters +deps = {[testenv:linters]deps} +commands = + python -m pre_commit run trailing-whitespace -a + +[testenv:shebangs] +envdir = {toxworkdir}/linters +deps = {[testenv:linters]deps} +commands = + python -m pre_commit run check-executables-have-shebangs -a + +[testenv:linters] +deps = + -r {toxinidir}/requirements.txt + -r {toxinidir}/test-requirements.txt + -r {toxinidir}/molecule-requirements.txt +commands = + {[testenv:pep8]commands} + {[testenv:ansible-lint]commands} + {[testenv:bashate]commands} + {[testenv:whitespace]commands} + {[testenv:shebangs]commands} +# {[testenv:yamllint]commands} + +[testenv:releasenotes] +basepython = python3 +deps = -r{toxinidir}/doc/requirements.txt +commands = + sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html + +[testenv:cover] basepython = python3 deps = - -c{toxinidir}/lower-constraints.txt - -r{toxinidir}/test-requirements.txt - -r{toxinidir}/requirements.txt + -r {toxinidir}/requirements.txt + -r {toxinidir}/test-requirements.txt + -r {toxinidir}/molecule-requirements.txt +commands = python setup.py test --coverage --testr-args='{posargs}' + +[testenv:docs] +basepython = python3 +deps = + -r {toxinidir}/doc/requirements.txt + -r {toxinidir}/molecule-requirements.txt +commands= + sphinx-build -a -E -W -d doc/build/doctrees -b html doc/source doc/build/html -T + doc8 doc + +[doc8] +# Settings for doc8: +extensions = .rst +ignore = D001 + +[testenv:venv] +commands = {posargs} [testenv:molecule] basepython = python3 @@ -93,3 +135,11 @@ deps = selinux commands = python -m pytest --color=yes --html={envlogdir}/reports.html --self-contained-html {tty:-s} {posargs:roles} + +[testenv:lower-constraints] +basepython = python3 +deps = + -c{toxinidir}/lower-constraints.txt + -r{toxinidir}/test-requirements.txt + -r{toxinidir}/requirements.txt + -r{toxinidir}/molecule-requirements.txt \ No newline at end of file diff --git a/validations/library/docker_facts.py b/validations/library/docker_facts.py index a2bd4cbd5..1be4002ed 100644 --- a/validations/library/docker_facts.py +++ b/validations/library/docker_facts.py @@ -17,6 +17,10 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function + +from ansible.module_utils.basic import AnsibleModule + +import itertools import six six.add_metaclass(type) @@ -114,10 +118,6 @@ docker: type: list """ -import itertools - -from ansible.module_utils.basic import AnsibleModule - DOCKER_SUBCOMMAND_LOOKUP = [ ('images', 'images', '-q'), ('volumes', 'volume ls', '-q'), diff --git a/validations/library/ini.py b/validations/library/ini.py index 86dfe4a42..debed94cc 100644 --- a/validations/library/ini.py +++ b/validations/library/ini.py @@ -79,6 +79,7 @@ def get_result(path, section, key): ret = ReturnValue.KEY_NOT_FOUND return (ret, msg, value) + DOCUMENTATION = ''' --- module: ini diff --git a/validations/lookup_plugins/ironic_nodes.py b/validations/lookup_plugins/ironic_nodes.py index 96362bfd0..84ded7ed1 100644 --- a/validations/lookup_plugins/ironic_nodes.py +++ b/validations/lookup_plugins/ironic_nodes.py @@ -15,6 +15,9 @@ # License for the specific language governing permissions and limitations # under the License. +from ansible.plugins.lookup import LookupBase +from tripleo_validations import utils + DOCUMENTATION = """ lookup: ironic_nodes description: Retrieve node information from Ironic @@ -65,10 +68,6 @@ _raw: description: A Python list with results from the API call. """ -from ansible.plugins.lookup import LookupBase - -from tripleo_validations import utils - class LookupModule(LookupBase): diff --git a/validations/lookup_plugins/nova_servers.py b/validations/lookup_plugins/nova_servers.py index 31507d9f1..ad6d51e34 100644 --- a/validations/lookup_plugins/nova_servers.py +++ b/validations/lookup_plugins/nova_servers.py @@ -15,6 +15,11 @@ # License for the specific language governing permissions and limitations # under the License. +from ansible.plugins.lookup import LookupBase +from novaclient.exceptions import NotFound + +from tripleo_validations import utils + DOCUMENTATION = """ lookup: nova_servers description: Retrieve server information from Nova @@ -51,11 +56,6 @@ _raw: description: A Python list with results from the API call. """ -from ansible.plugins.lookup import LookupBase -from novaclient.exceptions import NotFound - -from tripleo_validations import utils - class LookupModule(LookupBase): diff --git a/zuul.d/layout.yaml b/zuul.d/layout.yaml index 302474315..23f505286 100644 --- a/zuul.d/layout.yaml +++ b/zuul.d/layout.yaml @@ -1,22 +1,23 @@ - project: templates: - - tripleo-multinode-container-minimal - - openstack-python-jobs - - openstack-python35-jobs - - openstack-python36-jobs - - openstack-tox-molecule - - check-requirements - - publish-openstack-docs-pti - - release-notes-jobs-python3 + - tripleo-multinode-container-minimal + - openstack-python-jobs + - openstack-python35-jobs + - openstack-python36-jobs + - check-requirements + - publish-openstack-docs-pti + - release-notes-jobs-python3 check: jobs: - - openstack-tox-lower-constraints - - tripleo-ci-centos-7-scenario004-standalone: - files: - - ^roles/ceph.*$ + - openstack-tox-linters + - openstack-tox-lower-constraints + - tripleo-ci-centos-7-scenario004-standalone: + files: + - ^roles/ceph.*$ gate: jobs: - - openstack-tox-lower-constraints - - tripleo-ci-centos-7-scenario004-standalone: - files: - - ^roles/ceph.*$ + - openstack-tox-linters + - openstack-tox-lower-constraints + - tripleo-ci-centos-7-scenario004-standalone: + files: + - ^roles/ceph.*$