Browse Source

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 <gchamoul@redhat.com>
(cherry picked from commit cac3e7101d)
tags/10.5.1
Gael Chamoulaud 1 month ago
parent
commit
4d309d8e54

+ 17
- 5
.pre-commit-config.yaml View File

@@ -1,8 +1,9 @@
1 1
 ---
2 2
 repos:
3 3
   - repo: https://github.com/pre-commit/pre-commit-hooks
4
-    rev: v2.0.0
4
+    rev: v2.1.0
5 5
     hooks:
6
+      - id: end-of-file-fixer
6 7
       - id: trailing-whitespace
7 8
       - id: mixed-line-ending
8 9
       - id: check-byte-order-marker
@@ -10,20 +11,31 @@ repos:
10 11
       - id: check-merge-conflict
11 12
       - id: debug-statements
12 13
       - id: flake8
13
-        additional_dependencies:
14
-          - hacking<1.2.0,>=1.1.0
14
+        entry: flake8 --ignore=E123,E125,W503,W504,W605
15 15
       - id: check-yaml
16 16
         files: .*\.(yaml|yml)$
17 17
   - repo: https://github.com/adrienverge/yamllint.git
18
-    rev: v1.13.0
18
+    rev: v1.15.0
19 19
     hooks:
20 20
       - id: yamllint
21 21
         files: \.(yaml|yml)$
22 22
         types: [file, yaml]
23 23
         entry: yamllint --strict -f parsable
24 24
   - repo: https://github.com/ansible/ansible-lint
25
-    rev: v4.1.0
25
+    rev: v4.1.0a0
26 26
     hooks:
27 27
       - id: ansible-lint
28 28
         files: \.(yaml|yml)$
29 29
         entry: ansible-lint --force-color -v
30
+  - repo: https://github.com/openstack-dev/bashate.git
31
+    rev: 0.6.0
32
+    hooks:
33
+      - id: bashate
34
+        entry: bashate --error . --verbose --ignore=E006,E040
35
+        # Run bashate check for all bash scripts
36
+        # Ignores the following rules:
37
+        # E006: Line longer than 79 columns (as many scripts use jinja
38
+        #       templating, this is very difficult)
39
+        # E040: Syntax error determined using `bash -n` (as many scripts
40
+        #       use jinja templating, this will often fail and the syntax
41
+        #       error will be discovered in execution anyway)

+ 33
- 0
bindep.txt View File

@@ -0,0 +1,33 @@
1
+# This file facilitates OpenStack-CI package installation
2
+# before the execution of any tests.
3
+#
4
+# See the following for details:
5
+#  - https://docs.openstack.org/infra/bindep/
6
+#  - https://opendev.org/opendev/bindep/
7
+#
8
+# Even if the role does not make use of this facility, it
9
+# is better to have this file empty, otherwise OpenStack-CI
10
+# will fall back to installing its default packages which
11
+# will potentially be detrimental to the tests executed.
12
+
13
+# The gcc compiler
14
+gcc
15
+
16
+# Base requirements for RPM distros
17
+gcc-c++           [platform:rpm]
18
+git               [platform:rpm]
19
+libffi-devel      [platform:rpm]
20
+openssl-devel     [platform:rpm]
21
+python-devel      [platform:rpm]
22
+python2-dnf       [platform:fedora]
23
+python-virtualenv [platform:rpm]
24
+
25
+# For SELinux
26
+libselinux-python  [platform:rpm]
27
+libsemanage-python [platform:redhat]
28
+
29
+# Required for compressing collected log files in CI
30
+gzip
31
+
32
+# Required to build language docs
33
+gettext

+ 7
- 0
doc/requirements.txt View File

@@ -0,0 +1,7 @@
1
+# this is required for the docs build jobs
2
+sphinx!=1.6.6,!=1.6.7,>=1.6.2,<2.0.0;python_version=='2.7'  # BSD
3
+sphinx!=1.6.6,!=1.6.7,>=1.6.2;python_version>='3.4'  # BSD
4
+openstackdocstheme>=1.18.1 # Apache-2.0
5
+reno>=2.11.3 # Apache-2.0
6
+doc8>=0.8.0 # Apache-2.0
7
+bashate>=0.6.0 # Apache-2.0

+ 9
- 4
doc/source/_exts/generate_validations_doc.py View File

@@ -58,10 +58,14 @@ def get_validation_parameters(validation):
58 58
 
59 59
 
60 60
 def build_summary(group, validations):
61
-    entries = ["* :ref:`{}`: {}".format(group + '_' + validation['id'], validation['name'])
62
-               for validation in validations]
61
+    entries = [
62
+        "* :ref:`{}`: {}".format(group + '_' + validation['id'],
63
+                                 validation['name'])
64
+        for validation in validations
65
+    ]
63 66
     with open('doc/source/validations-{}.rst'.format(group), 'w') as f:
64 67
         f.write("\n".join(entries))
68
+        f.write("\n")
65 69
 
66 70
 
67 71
 def format_dict(my_dict):
@@ -83,10 +87,11 @@ def build_detail(group, validations):
83 87
 
84 88
 - **hosts**: {hosts}
85 89
 - **groups**: {groups}
86
-- **metadata**: {metadata}
87
-- **parameters**: {parameters}
90
+- **parameters**:{parameters}
88 91
 - **roles**: {roles}
89 92
 
93
+Role documentation
94
+
90 95
 .. toctree::
91 96
 
92 97
    roles/role-{roles}

+ 2
- 1
doc/source/conf.py View File

@@ -1,3 +1,4 @@
1
+#!/usr/bin/env python
1 2
 # -*- coding: utf-8 -*-
2 3
 # Licensed under the Apache License, Version 2.0 (the "License");
3 4
 # 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'))
26 27
 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
27 28
 extensions = [
28 29
     'sphinx.ext.autodoc',
29
-    #'sphinx.ext.intersphinx',
30
+    # 'sphinx.ext.intersphinx',
30 31
     'generate_validations_doc',
31 32
     'ansible-autodoc',
32 33
     'openstackdocstheme'

+ 1
- 3
doc/source/index.rst View File

@@ -4,7 +4,7 @@
4 4
    contain the root `toctree` directive.
5 5
 
6 6
 Welcome to tripleo-validations's documentation!
7
-========================================================
7
+===============================================
8 8
 
9 9
 Contents:
10 10
 
@@ -13,7 +13,6 @@ Contents:
13 13
 
14 14
    readme
15 15
    installation
16
-   usage
17 16
    contributing
18 17
    roles
19 18
    modules
@@ -38,4 +37,3 @@ Indices and tables
38 37
 
39 38
 * :ref:`genindex`
40 39
 * :ref:`search`
41
-

+ 15
- 1
doc/source/readme.rst View File

@@ -69,7 +69,7 @@ introspection.
69 69
 Pre Deployment
70 70
 ~~~~~~~~~~~~~~
71 71
 
72
-Validation that are run right before deploying the overcloud.
72
+Validations that are run right before deploying the overcloud.
73 73
 
74 74
 .. include:: validations-pre-deployment.rst
75 75
 
@@ -94,6 +94,20 @@ Validations that are run right before a major upgrade of the undercloud or overc
94 94
 
95 95
 .. include:: validations-pre-upgrade.rst
96 96
 
97
+Post Upgrade
98
+~~~~~~~~~~~~
99
+
100
+Validations that are run right after a major upgrade of the undercloud or overcloud.
101
+
102
+.. include:: validations-post-upgrade.rst
103
+
104
+OpenShift On OpenStack
105
+~~~~~~~~~~~~~~~~~~~~~~
106
+
107
+Validations that are run right after the undercloud is installed.
108
+
109
+.. include:: validations-openshift-on-openstack.rst
110
+
97 111
 
98 112
 Writing Validations
99 113
 -------------------

+ 0
- 7
doc/source/roles/role-check-latest-minor-version.rst View File

@@ -1,7 +0,0 @@
1
-==========================
2
-check-latest-minor-version
3
-==========================
4
-
5
-.. ansibleautoplugin::
6
-   :role: roles/check-latest-minor-version
7
-

+ 6
- 0
doc/source/roles/role-check-latest-packages-version.rst View File

@@ -0,0 +1,6 @@
1
+=============================
2
+check-latest-packages-version
3
+=============================
4
+
5
+.. ansibleautoplugin::
6
+   :role: roles/check-latest-packages-version

+ 2
- 0
library/check_ironic_boot_config.py View File

@@ -84,6 +84,7 @@ def _all_possible_names(arch, platform, image_name_base):
84 84
         yield _name_helper(image_name_base, arch=arch)
85 85
     yield _name_helper(image_name_base)
86 86
 
87
+
87 88
 MISMATCH = (
88 89
     "\nNode {} has an incorrectly configured driver_info/deploy_{}. Expected "
89 90
     "{} but got {}."
@@ -182,5 +183,6 @@ def main():
182 183
     else:
183 184
         module.exit_json()
184 185
 
186
+
185 187
 if __name__ == '__main__':
186 188
     main()

+ 4
- 4
library/docker_facts.py View File

@@ -17,6 +17,10 @@
17 17
 from __future__ import absolute_import
18 18
 from __future__ import division
19 19
 from __future__ import print_function
20
+import itertools
21
+
22
+from ansible.module_utils.basic import AnsibleModule
23
+
20 24
 import six
21 25
 six.add_metaclass(type)
22 26
 
@@ -114,10 +118,6 @@ docker:
114 118
         type: list
115 119
 """
116 120
 
117
-import itertools
118
-
119
-from ansible.module_utils.basic import AnsibleModule
120
-
121 121
 DOCKER_SUBCOMMAND_LOOKUP = [
122 122
     ('images', 'images', '-q'),
123 123
     ('volumes', 'volume ls', '-q'),

+ 3
- 3
library/haproxy_conf.py View File

@@ -56,14 +56,14 @@ def generic_ini_style_conf_parser(file_path, section_regex, option_regex):
56 56
                 config[current_section] = {}
57 57
             match_option = re.match(option_regex, line)
58 58
             if match_option and current_section:
59
-                option = re.sub('\s+', ' ', match_option.group(1))
59
+                option = re.sub(r'\s+', ' ', match_option.group(1))
60 60
                 config[current_section][option] = match_option.group(2)
61 61
     return config
62 62
 
63 63
 
64 64
 def parse_haproxy_conf(file_path):
65
-    section_regex = '^(\w+)'
66
-    option_regex = '^(?:\s+)(\w+(?:\s+\w+)*?)\s+([\w/]*)$'
65
+    section_regex = r'^(\w+)'
66
+    option_regex = r'^(?:\s+)(\w+(?:\s+\w+)*?)\s+([\w/]*)$'
67 67
     return generic_ini_style_conf_parser(file_path, section_regex,
68 68
                                          option_regex)
69 69
 

+ 1
- 0
library/ini.py View File

@@ -79,6 +79,7 @@ def get_result(path, section, key):
79 79
         ret = ReturnValue.KEY_NOT_FOUND
80 80
         return (ret, msg, value)
81 81
 
82
+
82 83
 DOCUMENTATION = '''
83 84
 ---
84 85
 module: ini

+ 4
- 4
lookup_plugins/ironic_nodes.py View File

@@ -15,6 +15,10 @@
15 15
 # License for the specific language governing permissions and limitations
16 16
 # under the License.
17 17
 
18
+from ansible.plugins.lookup import LookupBase
19
+
20
+from tripleo_validations import utils
21
+
18 22
 DOCUMENTATION = """
19 23
     lookup: ironic_nodes
20 24
     description: Retrieve node information from Ironic
@@ -65,10 +69,6 @@ _raw:
65 69
     description: A Python list with results from the API call.
66 70
 """
67 71
 
68
-from ansible.plugins.lookup import LookupBase
69
-
70
-from tripleo_validations import utils
71
-
72 72
 
73 73
 class LookupModule(LookupBase):
74 74
 

+ 6
- 5
lookup_plugins/nova_servers.py View File

@@ -15,6 +15,12 @@
15 15
 # License for the specific language governing permissions and limitations
16 16
 # under the License.
17 17
 
18
+from ansible.plugins.lookup import LookupBase
19
+from novaclient.exceptions import NotFound
20
+
21
+from tripleo_validations import utils
22
+
23
+
18 24
 DOCUMENTATION = """
19 25
     lookup: nova_servers
20 26
     description: Retrieve server information from Nova
@@ -51,11 +57,6 @@ _raw:
51 57
     description: A Python list with results from the API call.
52 58
 """
53 59
 
54
-from ansible.plugins.lookup import LookupBase
55
-from novaclient.exceptions import NotFound
56
-
57
-from tripleo_validations import utils
58
-
59 60
 
60 61
 class LookupModule(LookupBase):
61 62
 

+ 10
- 0
molecule-requirements.txt View File

@@ -0,0 +1,10 @@
1
+# this is required for the molecule jobs
2
+ansible
3
+ansi2html
4
+docker
5
+pytest
6
+pytest-cov
7
+pytest-html
8
+pytest-xdist
9
+mock
10
+molecule>=2.22rc1

+ 2
- 4
playbooks/nova-status.yaml View File

@@ -14,10 +14,8 @@
14 14
         The nova-status upgrade check command has three standard return codes:
15 15
 
16 16
         0 -> All upgrade readiness checks passed successfully and there is nothing to do.
17
-        1 -> At least one check encountered an issue and requires further investigation.
18
-             This is considered a warning but the upgrade may be OK.
19
-        2 -> There was an upgrade status check failure that needs to be investigated.
20
-             This should be considered something that stops an upgrade.
17
+        1 -> At least one check encountered an issue and requires further investigation. This is considered a warning but the upgrade may be OK.
18
+        2 -> There was an upgrade status check failure that needs to be investigated. This should be considered something that stops an upgrade.
21 19
       groups:
22 20
         - pre-upgrade
23 21
   roles:

+ 4
- 9
playbooks/openshift-hw-requirements.yaml View File

@@ -7,15 +7,10 @@
7 7
         Check if there are enough resources for an OpenShift deployment on top
8 8
         of Openstack
9 9
         deployment:
10
-        - Is there a flavor that meets the minimum requirements for a test
11
-          environment?
12
-          (4GB RAM, 40GB disk)
13
-        - Is there a flavor that meets the minimum requirements for a
14
-          production environment?
15
-          (16GB RAM, 40GB disk, 4 VCPUs)
10
+        - Is there a flavor that meets the minimum requirements for a test environment? (4GB RAM, 40GB disk)
11
+        - Is there a flavor that meets the minimum requirements for a production environment? (16GB RAM, 40GB disk, 4 VCPUs)
16 12
         - Are images named centos or rhel available?
17
-        - Are there sufficient compute resources available for a default setup?
18
-          (1 Master node, 1 Infra node, 2 App nodes)
13
+        - Are there sufficient compute resources available for a default setup? (1 Master node, 1 Infra node, 2 App nodes)
19 14
       groups:
20 15
       - openshift-on-openstack
21 16
     min_total_ram_testing: 16384    # 4 per node
@@ -33,4 +28,4 @@
33 28
   tasks:
34 29
     - include_role:
35 30
         name: openshift-on-openstack
36
-        tasks_from: openshift-hw-requirements
31
+        tasks_from: openshift-hw-requirements.yaml

+ 1
- 1
playbooks/openshift-nw-requirements.yaml View File

@@ -11,4 +11,4 @@
11 11
   tasks:
12 12
     - include_role:
13 13
         name: openshift-on-openstack
14
-        tasks_from: openshift-nw-requirements
14
+        tasks_from: openshift-nw-requirements.yaml

+ 1
- 1
playbooks/stack-health.yaml View File

@@ -4,7 +4,7 @@
4 4
     metadata:
5 5
       name: Stack Health Check
6 6
       description: >
7
-        Check if all stack resources are in a *_COMPLETE state before starting
7
+        Check if all stack resources are in a 'COMPLETE' state before starting
8 8
         an upgrade.
9 9
       groups:
10 10
         - pre-upgrade

+ 1
- 1
releasenotes/notes/ip-range-validation-result-daddc8c015dd34c0.yaml View File

@@ -2,5 +2,5 @@
2 2
 fixes:
3 3
   - |
4 4
     Instead of only outputting a warning, the IP range validation now fails if
5
-    the number of available addresses is lower than the recommended minimum. 
5
+    the number of available addresses is lower than the recommended minimum.
6 6
     (Fixes https://bugs.launchpad.net/tripleo/+bug/1713483)

+ 6
- 4
roles/openshift-on-openstack/tasks/openshift-hw-requirements.yaml View File

@@ -132,14 +132,16 @@
132 132
     warning_msg: |
133 133
       {{ lookup('template', './templates/openshift-hw-requirements-warnings.j2') }}
134 134
 
135
-- name: Fail if minimum requirements aren't met
136
-  fail: msg="{{ warning_msg }}"
135
+- name: Fail if minimum requirements are not met
136
+  fail:
137
+    msg: "{{ warning_msg }}"
137 138
   when: not matching_flavors_testing
138 139
         or not matching_image
139 140
         or not resource_reqs_testing
140 141
 
141
-- name: Warn if production requirements aren't met
142
-  warn: msg="{{ warning_msg }}"
142
+- name: Warn if production requirements are not met
143
+  warn:
144
+    msg: "{{ warning_msg }}"
143 145
   when: not matching_flavors_prod
144 146
         or not matching_image
145 147
         or not resource_reqs_prod

+ 1
- 0
test-requirements.txt View File

@@ -15,3 +15,4 @@ testscenarios>=0.4 # Apache-2.0/BSD
15 15
 testtools>=2.2.0 # MIT
16 16
 reno>=2.5.0 # Apache-2.0
17 17
 netaddr>=0.7.18 # BSD
18
+pre-commit # MIT

+ 1
- 2
tools/releasenotes_tox.sh View File

@@ -11,8 +11,7 @@ BUILD_RESULT=$?
11 11
 UNCOMMITTED_NOTES=$(git status --porcelain | \
12 12
     awk '$1 == "M" && $2 ~ /releasenotes\/notes/ {print $2}')
13 13
 
14
-if [ "${UNCOMMITTED_NOTES}" ]
15
-then
14
+if [ "${UNCOMMITTED_NOTES}" ]; then
16 15
     cat <<EOF
17 16
 
18 17
 REMINDER: The following changes to release notes have not been committed:

+ 1
- 0
tools/validate-files.py View File

@@ -48,6 +48,7 @@ def parse_args():
48 48
 
49 49
     return p.parse_args()
50 50
 
51
+
51 52
 args = parse_args()
52 53
 path_args = args.path_args
53 54
 quiet = args.quiet

+ 102
- 52
tox.ini View File

@@ -1,82 +1,124 @@
1 1
 [tox]
2 2
 minversion = 3.8
3
-envlist = pep8,py35,py36,py27,molecule
4
-skipsdist = True
3
+envlist = linters,docs,py27,py35,py36,molecule
4
+skipdist = True
5 5
 
6 6
 [testenv]
7 7
 usedevelop = True
8
+install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} {opts} {packages}
9
+passenv = *
8 10
 setenv =
9
-    ANSIBLE_FORCE_COLOR=1
10
-    ANSIBLE_NOCOWS=1
11
-    ANSIBLE_RETRY_FILES_ENABLED=0
12
-    ANSIBLE_STDOUT_CALLBACK=debug
13
-    PY_COLORS=1
14
-    VIRTUAL_ENV={envdir}
15
-    # pip: Avoid 2020-01-01 warnings: https://github.com/pypa/pip/issues/6207
16
-    # paramiko CryptographyDeprecationWarning: https://github.com/ansible/ansible/issues/52598
17
-    PYTHONWARNINGS=ignore:DEPRECATION::pip._internal.cli.base_command,ignore::UserWarning
18
-    PIP_DISABLE_PIP_VERSION_CHECK=1
19
-passenv =
20
-    ANSIBLE_*
21
-    DOCKER_*
22
-    MOLECULE_*
23
-    PYTEST*
24
-    SSH_AUTH_SOCK
25
-    TERM
26
-install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} {opts} {packages} "ansible>=2" "pre-commit>=1.10"
27
-deps = -r{toxinidir}/test-requirements.txt
11
+  ANSIBLE_NOCOWS=1
12
+  ANSIBLE_RETRY_FILES_ENABLED=0
13
+  ANSIBLE_STDOUT_CALLBACK=debug
14
+  ANSIBLE_LOG_PATH={envlogdir}/ansible-execution.log
15
+  PY_COLORS=1
16
+  VIRTUAL_ENV={envdir}
17
+  # pip: Avoid 2020-01-01 warnings: https://github.com/pypa/pip/issues/6207
18
+  # paramiko CryptographyDeprecationWarning: https://github.com/ansible/ansible/issues/52598
19
+  PYTHONWARNINGS=ignore:DEPRECATION::pip._internal.cli.base_command,ignore::UserWarning
20
+  PIP_DISABLE_PIP_VERSION_CHECK=1
28 21
 commands = python setup.py test --slowest --testr-args='{posargs}'
22
+sitepackages = True
23
+deps =
24
+    -r {toxinidir}/requirements.txt
25
+    -r {toxinidir}/test-requirements.txt
26
+    -r {toxinidir}/molecule-requirements.txt
29 27
 whitelist_externals =
30 28
     bash
31 29
     tox
32 30
 
33
-[testenv:releasenotes]
31
+[testenv:bindep]
32
+# Do not install any requirements. We want this to be fast and work even if
33
+# system dependencies are missing, since it's used to tell you what system
34
+# dependencies are missing! This also means that bindep must be installed
35
+# separately, outside of the requirements files.
36
+deps = bindep
37
+commands = bindep test
38
+
39
+[testenv:debug]
34 40
 basepython = python3
35
-whitelist_externals = bash
36
-commands = bash -c tools/releasenotes_tox.sh
41
+commands = oslo_debug_helper {posargs}
37 42
 
38 43
 [testenv:pep8]
39
-basepython = python3
44
+envdir = {toxworkdir}/linters
45
+commands =
46
+    python -m pre_commit run flake8 -a
47
+
48
+[testenv:ansible-lint]
49
+envdir = {toxworkdir}/linters
50
+deps =
51
+  {[testenv:linters]deps}
40 52
 commands =
53
+  python -m pre_commit run ansible-lint -a
54
+
55
+[testenv:yamllint]
56
+envdir = {toxworkdir}/linters
57
+deps = {[testenv:linters]deps}
58
+commands =
59
+    python -m pre_commit run yamllint -a
60
+
61
+[testenv:bashate]
62
+envdir = {toxworkdir}/linters
63
+deps = {[testenv:linters]deps}
64
+commands =
65
+    python -m pre_commit run bashate -a
66
+
67
+[testenv:whitespace]
68
+envdir = {toxworkdir}/linters
69
+deps = {[testenv:linters]deps}
70
+commands =
71
+    python -m pre_commit run trailing-whitespace -a
72
+
73
+[testenv:shebangs]
74
+envdir = {toxworkdir}/linters
75
+deps = {[testenv:linters]deps}
76
+commands =
77
+    python -m pre_commit run check-executables-have-shebangs -a
78
+
79
+[testenv:linters]
80
+deps =
81
+    -r {toxinidir}/requirements.txt
82
+    -r {toxinidir}/test-requirements.txt
83
+    -r {toxinidir}/molecule-requirements.txt
84
+commands =
85
+    {[testenv:pep8]commands}
41 86
     {[testenv:ansible-lint]commands}
42
-    flake8 {posargs}
43
-    python ./tools/validate-files.py .
87
+    {[testenv:bashate]commands}
88
+    {[testenv:whitespace]commands}
89
+    {[testenv:shebangs]commands}
90
+#    {[testenv:yamllint]commands}
44 91
 
45
-[testenv:venv]
92
+[testenv:releasenotes]
46 93
 basepython = python3
47
-commands = {posargs}
94
+deps = -r{toxinidir}/doc/requirements.txt
95
+commands =
96
+    sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
48 97
 
49 98
 [testenv:cover]
50 99
 basepython = python3
100
+deps =
101
+    -r {toxinidir}/requirements.txt
102
+    -r {toxinidir}/test-requirements.txt
103
+    -r {toxinidir}/molecule-requirements.txt
51 104
 commands = python setup.py test --coverage --testr-args='{posargs}'
52 105
 
53 106
 [testenv:docs]
54 107
 basepython = python3
55
-commands = python setup.py build_sphinx
56
-
57
-[testenv:debug]
58
-basepython = python3
59
-commands = oslo_debug_helper {posargs}
60
-
61
-[testenv:ansible-lint]
62
-basepython = python3
63
-commands =
64
-  python -m pre_commit run ansible-lint -a
65
-
66
-[flake8]
67
-# E123, E125 skipped as they are invalid PEP-8.
108
+deps =
109
+  -r {toxinidir}/doc/requirements.txt
110
+  -r {toxinidir}/molecule-requirements.txt
111
+commands=
112
+    sphinx-build -a -E -W -d doc/build/doctrees -b html doc/source doc/build/html -T
113
+    doc8 doc
68 114
 
69
-show-source = True
70
-ignore = E123,E125
71
-builtins = _
72
-exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
115
+[doc8]
116
+# Settings for doc8:
117
+extensions = .rst
118
+ignore = D001
73 119
 
74
-[testenv:lower-constraints]
75
-basepython = python3
76
-deps =
77
-  -c{toxinidir}/lower-constraints.txt
78
-  -r{toxinidir}/test-requirements.txt
79
-  -r{toxinidir}/requirements.txt
120
+[testenv:venv]
121
+commands = {posargs}
80 122
 
81 123
 [testenv:molecule]
82 124
 basepython = python3
@@ -93,3 +135,11 @@ deps =
93 135
     selinux
94 136
 commands =
95 137
     python -m pytest --color=yes --html={envlogdir}/reports.html --self-contained-html {tty:-s} {posargs:roles}
138
+
139
+[testenv:lower-constraints]
140
+basepython = python3
141
+deps =
142
+  -c{toxinidir}/lower-constraints.txt
143
+  -r{toxinidir}/test-requirements.txt
144
+  -r{toxinidir}/requirements.txt
145
+  -r{toxinidir}/molecule-requirements.txt

+ 4
- 4
validations/library/docker_facts.py View File

@@ -17,6 +17,10 @@
17 17
 from __future__ import absolute_import
18 18
 from __future__ import division
19 19
 from __future__ import print_function
20
+
21
+from ansible.module_utils.basic import AnsibleModule
22
+
23
+import itertools
20 24
 import six
21 25
 six.add_metaclass(type)
22 26
 
@@ -114,10 +118,6 @@ docker:
114 118
         type: list
115 119
 """
116 120
 
117
-import itertools
118
-
119
-from ansible.module_utils.basic import AnsibleModule
120
-
121 121
 DOCKER_SUBCOMMAND_LOOKUP = [
122 122
     ('images', 'images', '-q'),
123 123
     ('volumes', 'volume ls', '-q'),

+ 1
- 0
validations/library/ini.py View File

@@ -79,6 +79,7 @@ def get_result(path, section, key):
79 79
         ret = ReturnValue.KEY_NOT_FOUND
80 80
         return (ret, msg, value)
81 81
 
82
+
82 83
 DOCUMENTATION = '''
83 84
 ---
84 85
 module: ini

+ 3
- 4
validations/lookup_plugins/ironic_nodes.py View File

@@ -15,6 +15,9 @@
15 15
 # License for the specific language governing permissions and limitations
16 16
 # under the License.
17 17
 
18
+from ansible.plugins.lookup import LookupBase
19
+from tripleo_validations import utils
20
+
18 21
 DOCUMENTATION = """
19 22
     lookup: ironic_nodes
20 23
     description: Retrieve node information from Ironic
@@ -65,10 +68,6 @@ _raw:
65 68
     description: A Python list with results from the API call.
66 69
 """
67 70
 
68
-from ansible.plugins.lookup import LookupBase
69
-
70
-from tripleo_validations import utils
71
-
72 71
 
73 72
 class LookupModule(LookupBase):
74 73
 

+ 5
- 5
validations/lookup_plugins/nova_servers.py View File

@@ -15,6 +15,11 @@
15 15
 # License for the specific language governing permissions and limitations
16 16
 # under the License.
17 17
 
18
+from ansible.plugins.lookup import LookupBase
19
+from novaclient.exceptions import NotFound
20
+
21
+from tripleo_validations import utils
22
+
18 23
 DOCUMENTATION = """
19 24
     lookup: nova_servers
20 25
     description: Retrieve server information from Nova
@@ -51,11 +56,6 @@ _raw:
51 56
     description: A Python list with results from the API call.
52 57
 """
53 58
 
54
-from ansible.plugins.lookup import LookupBase
55
-from novaclient.exceptions import NotFound
56
-
57
-from tripleo_validations import utils
58
-
59 59
 
60 60
 class LookupModule(LookupBase):
61 61
 

+ 17
- 16
zuul.d/layout.yaml View File

@@ -1,22 +1,23 @@
1 1
 - project:
2 2
     templates:
3
-      - tripleo-multinode-container-minimal
4
-      - openstack-python-jobs
5
-      - openstack-python35-jobs
6
-      - openstack-python36-jobs
7
-      - openstack-tox-molecule
8
-      - check-requirements
9
-      - publish-openstack-docs-pti
10
-      - release-notes-jobs-python3
3
+    - tripleo-multinode-container-minimal
4
+    - openstack-python-jobs
5
+    - openstack-python35-jobs
6
+    - openstack-python36-jobs
7
+    - check-requirements
8
+    - publish-openstack-docs-pti
9
+    - release-notes-jobs-python3
11 10
     check:
12 11
       jobs:
13
-        - openstack-tox-lower-constraints
14
-        - tripleo-ci-centos-7-scenario004-standalone:
15
-            files:
16
-              - ^roles/ceph.*$
12
+      - openstack-tox-linters
13
+      - openstack-tox-lower-constraints
14
+      - tripleo-ci-centos-7-scenario004-standalone:
15
+          files:
16
+            - ^roles/ceph.*$
17 17
     gate:
18 18
       jobs:
19
-        - openstack-tox-lower-constraints
20
-        - tripleo-ci-centos-7-scenario004-standalone:
21
-            files:
22
-              - ^roles/ceph.*$
19
+      - openstack-tox-linters
20
+      - openstack-tox-lower-constraints
21
+      - tripleo-ci-centos-7-scenario004-standalone:
22
+          files:
23
+            - ^roles/ceph.*$

Loading…
Cancel
Save