Make groups documentation part dynamic

The groups.yaml file is now the source of information concerning the
validations groups. The groups information part is now created
dynamically by reading the groups.yaml file.

This patch also fixes the basepython conflict for the tox py37 testenv.

Change-Id: Id199fc250afa0646b1e851581e3a92290f7bcb00
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
(cherry picked from commit 42934b9a09)
This commit is contained in:
Gael Chamoulaud 2020-01-17 12:49:13 +01:00 committed by Cédric Jeanneret (Tengu)
parent 3b50632743
commit 63e2a133a0
51 changed files with 156 additions and 169 deletions

View File

@ -5,3 +5,4 @@ openstackdocstheme>=1.29.2 # Apache-2.0
reno>=2.11.3 # Apache-2.0
doc8>=0.8.0 # Apache-2.0
bashate>=0.6.0 # Apache-2.0
six>=1.11.0 # MIT

View File

@ -14,7 +14,7 @@
from glob import glob
import os
import six
import yaml
DEFAULT_METADATA = {
@ -113,18 +113,59 @@ Role documentation
f.write("\n".join(entries))
def build_groups_detail(groups):
entries = [
"""
{group}
{adornment}
{desc}
.. include:: {link}
"""
.format(group=grp.capitalize(),
adornment=(len(grp) * '~'),
link="validations-{}.rst".format(grp),
desc=desc[0].get('description', None),
)
for grp, desc in sorted(groups.items())]
with open('doc/source/validations-groups.rst', 'w') as f:
f.write("\n".join(entries))
def parse_groups_file():
contents = {}
groups_file_path = os.path.abspath('groups.yaml')
if os.path.exists(groups_file_path):
with open(groups_file_path, "r") as grps:
contents = yaml.safe_load(grps)
return contents
def get_groups():
# Seed it with the known groups from groups.yaml file.
groups = set()
contents = parse_groups_file()
for group_name in six.iterkeys(contents):
groups.add(group_name)
return groups, contents
def setup(app):
# Seed it with the known groups:
groups = set(('no-op', 'prep', 'pre-introspection',
'pre-deployment', 'post-deployment',
'pre-update', 'pre-upgrade',
'post-upgrade', 'openshift-on-openstack'))
group_name, group_info = get_groups()
build_groups_detail(group_info)
validations = []
for validation_path in sorted(glob('playbooks/*.yaml')):
with open(validation_path) as f:
loaded_validation = yaml.safe_load(f.read())[0]
for group in get_validation_metadata(loaded_validation, 'groups'):
groups.add(group)
group_name.add(group)
validations.append({
'hosts': loaded_validation['hosts'],
'parameters': get_validation_parameters(loaded_validation),
@ -138,7 +179,7 @@ def setup(app):
'roles': get_include_role(loaded_validation)
})
for group in groups:
for group in group_name:
validations_in_group = [validation for validation
in validations
if group in validation['groups']]

View File

@ -28,9 +28,10 @@ Existing validations:
validations-pre-deployment-details
validations-post-deployment-details
validations-openshift-on-openstack-details
validations-pre-update-details
validations-pre-upgrade-details
validations-post-upgrade-details
validations-pre-ceph-details
validations-post-ceph-details
Indices and tables
==================

View File

@ -43,71 +43,18 @@ the deployment stage they're should be run on.
Validations can belong to multiple groups.
No op
~~~~~
.. include:: validations-groups.rst
A validation doing nothing for testing the framework
.. include:: validations-no-op.rst
Prep
~~~~
Validations that are run on a fresh machine *before* the undercloud is
installed.
.. include:: validations-prep.rst
Pre Introspection
~~~~~~~~~~~~~~~~~
Validations that are run when the undercloud is ready to perform hardware
introspection.
.. include:: validations-pre-introspection.rst
Pre Deployment
~~~~~~~~~~~~~~
Validations that are run right before deploying the overcloud.
.. include:: validations-pre-deployment.rst
Post Deployment
~~~~~~~~~~~~~~~
Validations that are run after the overcloud deployment finished.
.. include:: validations-post-deployment.rst
Pre Update
~~~~~~~~~~
Validations that are run right before a minor update of the undercloud or overcloud.
.. include:: validations-pre-update.rst
Pre Upgrade
~~~~~~~~~~~
Validations that are run right before a major upgrade of the undercloud or overcloud.
.. 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
To add a new group, you will need to edit the ``groups.yaml`` file located in
the root of the TripleO Validations directory::
$ [vim|emacs] groups.yaml
...
pre-update:
- description: >-
Validations which try to validate your OpenStack deployment before you
update it.
...
Writing Validations
-------------------

View File

@ -1,7 +1,7 @@
============================
advanced-format-512e-support
advanced_format_512e_support
============================
.. ansibleautoplugin::
:role: roles/advanced-format-512e-support
:role: roles/advanced_format_512e_support

View File

@ -1,7 +1,7 @@
=================
ceilometerdb-size
ceilometerdb_size
=================
.. ansibleautoplugin::
:role: roles/ceilometerdb-size
:role: roles/ceilometerdb_size

View File

@ -1,6 +1,6 @@
=============================
check-latest-packages-version
check_latest_packages_version
=============================
.. ansibleautoplugin::
:role: roles/check-latest-packages-version
:role: roles/check_latest_packages_version

View File

@ -1,7 +1,7 @@
=====================
undercloud-disk-space
check_network_gateway
=====================
.. ansibleautoplugin::
:role: roles/undercloud-disk-space
:role: roles/check_network_gateway

View File

@ -1,7 +1,7 @@
===================================
collect-flavors-and-verify-profiles
collect_flavors_and_verify_profiles
===================================
.. ansibleautoplugin::
:role: roles/collect-flavors-and-verify-profiles
:role: roles/collect_flavors_and_verify_profiles

View File

@ -1,6 +1,6 @@
================
validate-selinux
container_status
================
.. ansibleautoplugin::
:role: roles/validate-selinux
:role: roles/container_status

View File

@ -1,7 +1,7 @@
===============================
containerized-undercloud-docker
containerized_undercloud_docker
===============================
.. ansibleautoplugin::
:role: roles/containerized-undercloud-docker
:role: roles/containerized_undercloud_docker

View File

@ -1,7 +1,7 @@
================
controller-token
controller_token
================
.. ansibleautoplugin::
:role: roles/controller-token
:role: roles/controller_token

View File

@ -1,7 +1,7 @@
==================
default-node-count
controller_ulimits
==================
.. ansibleautoplugin::
:role: roles/default-node-count
:role: roles/controller_ulimits

View File

@ -1,7 +1,7 @@
=================
ctlplane-ip-range
ctlplane_ip_range
=================
.. ansibleautoplugin::
:role: roles/ctlplane-ip-range
:role: roles/ctlplane_ip_range

View File

@ -1,7 +1,7 @@
==================
controller-ulimits
default_node_count
==================
.. ansibleautoplugin::
:role: roles/controller-ulimits
:role: roles/default_node_count

View File

@ -1,7 +1,7 @@
================
dhcp-validations
dhcp_validations
================
.. ansibleautoplugin::
:role: roles/dhcp-validations
:role: roles/dhcp_validations

View File

@ -1,6 +1,6 @@
==========================
healthcheck-service-status
healthcheck_service_status
==========================
.. ansibleautoplugin::
:role: roles/healthcheck-service-status
:role: roles/healthcheck_service_status

View File

@ -1,7 +1,7 @@
===========
nova-status
image_serve
===========
.. ansibleautoplugin::
:role: roles/nova-status
:role: roles/image_serve

View File

@ -1,7 +1,7 @@
=========================
ironic-boot-configuration
ironic_boot_configuration
=========================
.. ansibleautoplugin::
:role: roles/ironic-boot-configuration
:role: roles/ironic_boot_configuration

View File

@ -1,7 +1,7 @@
======================
mysql-open-files-limit
mysql_open_files_limit
======================
.. ansibleautoplugin::
:role: roles/mysql-open-files-limit
:role: roles/mysql_open_files_limit

View File

@ -1,7 +1,7 @@
===================
network-environment
network_environment
===================
.. ansibleautoplugin::
:role: roles/network-environment
:role: roles/network_environment

View File

@ -1,7 +1,7 @@
====================
neutron-sanity-check
neutron_sanity_check
====================
.. ansibleautoplugin::
:role: roles/neutron-sanity-check
:role: roles/neutron_sanity_check

View File

@ -1,7 +1,7 @@
=====
no-op
no_op
=====
.. ansibleautoplugin::
:role: roles/no-op
:role: roles/no_op

View File

@ -3,5 +3,4 @@ no-op-firewall-nova-driver
==========================
.. ansibleautoplugin::
:role: roles/no-op-firewall-nova-driver
:role: roles/no_op_firewall_nova_driver

View File

@ -1,7 +1,7 @@
==========
node-disks
node_disks
==========
.. ansibleautoplugin::
:role: roles/node-disks
:role: roles/node_disks

View File

@ -1,7 +1,7 @@
===========
node-health
node_health
===========
.. ansibleautoplugin::
:role: roles/node-health
:role: roles/node_health

View File

@ -1,7 +1,7 @@
===================
nova-event-callback
nova_event_callback
===================
.. ansibleautoplugin::
:role: roles/nova-event-callback
:role: roles/nova_event_callback

View File

@ -1,7 +1,7 @@
===========
image-serve
nova_status
===========
.. ansibleautoplugin::
:role: roles/image-serve
:role: roles/nova_status

View File

@ -1,7 +1,7 @@
======================
openshift-on-openstack
openshift_on_openstack
======================
.. ansibleautoplugin::
:role: roles/openshift-on-openstack
:role: roles/openshift_on_openstack

View File

@ -1,7 +1,7 @@
===================
openstack-endpoints
openstack_endpoints
===================
.. ansibleautoplugin::
:role: roles/openstack-endpoints
:role: roles/openstack_endpoints

View File

@ -1,7 +1,7 @@
============
ovs-dpdk-pmd
ovs_dpdk_pmd
============
.. ansibleautoplugin::
:role: roles/ovs-dpdk-pmd
:role: roles/ovs_dpdk_pmd

View File

@ -1,7 +1,7 @@
================
undercloud-debug
pacemaker_status
================
.. ansibleautoplugin::
:role: roles/undercloud-debug
:role: roles/pacemaker_status

View File

@ -1,7 +1,7 @@
===============
rabbitmq-limits
rabbitmq_limits
===============
.. ansibleautoplugin::
:role: roles/rabbitmq-limits
:role: roles/rabbitmq_limits

View File

@ -1,7 +1,7 @@
==============
service-status
service_status
==============
.. ansibleautoplugin::
:role: roles/service-status
:role: roles/service_status

View File

@ -1,7 +1,7 @@
============
stack-health
stack_health
============
.. ansibleautoplugin::
:role: roles/stack-health
:role: roles/stack_health

View File

@ -1,7 +1,7 @@
==============
stonith-exists
stonith_exists
==============
.. ansibleautoplugin::
:role: roles/stonith-exists
:role: roles/stonith_exists

View File

@ -1,7 +1,7 @@
============
switch-vlans
switch_vlans
============
.. ansibleautoplugin::
:role: roles/switch-vlans
:role: roles/switch_vlans

View File

@ -1,7 +1,7 @@
==============
tls-everywhere
tls_everywhere
==============
.. ansibleautoplugin::
:role: roles/tls-everywhere
:role: roles/tls_everywhere

View File

@ -1,7 +0,0 @@
==============
undercloud-ram
==============
.. ansibleautoplugin::
:role: roles/undercloud-ram

View File

@ -1,7 +1,7 @@
==============
undercloud-cpu
undercloud_cpu
==============
.. ansibleautoplugin::
:role: roles/undercloud-cpu
:role: roles/undercloud_cpu

View File

@ -1,7 +1,7 @@
================
pacemaker-status
undercloud_debug
================
.. ansibleautoplugin::
:role: roles/pacemaker-status
:role: roles/undercloud_debug

View File

@ -1,7 +1,7 @@
=====================
undercloud-tokenflush
undercloud_disk_space
=====================
.. ansibleautoplugin::
:role: roles/undercloud-tokenflush
:role: roles/undercloud_disk_space

View File

@ -1,7 +1,7 @@
=============================
undercloud-heat-purge-deleted
undercloud_heat_purge_deleted
=============================
.. ansibleautoplugin::
:role: roles/undercloud-heat-purge-deleted
:role: roles/undercloud_heat_purge_deleted

View File

@ -1,7 +1,7 @@
========================
undercloud-process-count
undercloud_process_count
========================
.. ansibleautoplugin::
:role: roles/undercloud-process-count
:role: roles/undercloud_process_count

View File

@ -0,0 +1,7 @@
==============
undercloud_ram
==============
.. ansibleautoplugin::
:role: roles/undercloud_ram

View File

@ -1,7 +1,7 @@
=======================
undercloud-selinux-mode
undercloud_selinux_mode
=======================
.. ansibleautoplugin::
:role: roles/undercloud-selinux-mode
:role: roles/undercloud_selinux_mode

View File

@ -1,7 +1,7 @@
=========================
undercloud-service-status
undercloud_service_status
=========================
.. ansibleautoplugin::
:role: roles/undercloud-service-status
:role: roles/undercloud_service_status

View File

@ -1,7 +1,6 @@
=====================
check-network-gateway
undercloud_tokenflush
=====================
.. ansibleautoplugin::
:role: roles/check-network-gateway
:role: roles/undercloud_tokenflush

View File

@ -1,6 +1,6 @@
================
container-status
validate_selinux
================
.. ansibleautoplugin::
:role: roles/container-status
:role: roles/validate_selinux

View File

@ -1,8 +1,8 @@
===============
xfs-check-ftype
xfs_check_ftype
===============
.. ansibleautoplugin::
:role: roles/xfs-check-ftype
:role: roles/xfs_check_ftype

View File

@ -5,7 +5,6 @@ skipdist = True
[testenv]
usedevelop = True
basepython = python3
passenv = *
setenv =
ANSIBLE_CALLBACK_PLUGINS={toxinidir}/callback_plugins