From 1d2149e934b1cd77c153ea3e832bf4b98c4c7e9e Mon Sep 17 00:00:00 2001 From: Jiri Podivin <jpodivin@redhat.com> Date: Tue, 18 May 2021 16:13:15 +0200 Subject: [PATCH] Unblocking the openstack-tox-docs job. Fixing indentation error breaking openstack-tox-docs Adjusts openstack-tox-docs job to be triggered by the validations_common directory changes. Introducing upper-requirements constraint to the doc build dependencies. Adjusts ansible_autodoc to handle missing molecule confs. Signed-off-by: Jiri Podivin <jpodivin@redhat.com> Change-Id: I8021f786476b61bbf88bf21a1151ce3198f7abbd --- .zuul.yaml | 1 + doc/source/_exts/ansible-autodoc.py | 50 +++++++++---------- tox.ini | 1 + .../callback_plugins/test_validation_json.py | 3 +- 4 files changed, 29 insertions(+), 26 deletions(-) diff --git a/.zuul.yaml b/.zuul.yaml index 9dc1825..3d4dcf0 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -69,6 +69,7 @@ files: - ^doc/.* - ^README.rst + - ^validations_common/.* gate: jobs: - openstack-tox-linters diff --git a/doc/source/_exts/ansible-autodoc.py b/doc/source/_exts/ansible-autodoc.py index d26dd1c..87e8cfb 100644 --- a/doc/source/_exts/ansible-autodoc.py +++ b/doc/source/_exts/ansible-autodoc.py @@ -265,36 +265,36 @@ class AnsibleAutoPluginDirective(Directive): ) with open(molecule_file) as f: molecule_conf = DOCYAML.load(f.read()) - - driver_data = molecule_conf.get('driver') - if driver_data: - molecule_section.append( - nodes.field_name( - text='Driver: {}'.format( - driver_data['name'] - ) - ) - ) - - options = driver_data.get('options') - if options: + if molecule_conf: + driver_data = molecule_conf.get('driver') + if driver_data: molecule_section.append( - self._yaml_section( - to_yaml_data=options, - section_title='Molecule Options' + nodes.field_name( + text='Driver: {}'.format( + driver_data['name'] + ) ) ) - provisioner_data = molecule_conf.get('provisioner') - if provisioner_data: - inventory = provisioner_data.get('inventory') - if inventory: - molecule_section.append( - self._yaml_section( - to_yaml_data=inventory, - section_title='Molecule Inventory' + options = driver_data.get('options') + if options: + molecule_section.append( + self._yaml_section( + to_yaml_data=options, + section_title='Molecule Options' + ) + ) + + provisioner_data = molecule_conf.get('provisioner') + if provisioner_data: + inventory = provisioner_data.get('inventory') + if inventory: + molecule_section.append( + self._yaml_section( + to_yaml_data=inventory, + section_title='Molecule Inventory' + ) ) - ) molecule_playbook_path = os.path.join( molecule_path, diff --git a/tox.ini b/tox.ini index b4501dd..520db30 100644 --- a/tox.ini +++ b/tox.ini @@ -127,6 +127,7 @@ commands = [testenv:docs] deps = + -c {env:TOX_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} -r {toxinidir}/doc/requirements.txt -r {toxinidir}/molecule-requirements.txt commands= diff --git a/validations_common/tests/callback_plugins/test_validation_json.py b/validations_common/tests/callback_plugins/test_validation_json.py index a5d9f26..768fbcc 100644 --- a/validations_common/tests/callback_plugins/test_validation_json.py +++ b/validations_common/tests/callback_plugins/test_validation_json.py @@ -44,7 +44,8 @@ def is_iso_time(time_string): with the default delimiter. Regex is somewhat convoluted, but general enough to last at least until the 9999 AD. - Returns: + + :returns: True if string matches the pattern. False otherwise. """