From fdf33902c2cd39509d1ebef84714dc4728f06a69 Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Wed, 15 Nov 2017 22:43:39 -0600 Subject: [PATCH] Add dynamic table for our tested Scenarios This change adds in a dynamic table to our documentation so that we're able to generate a table of all available scenarios and mark where services are tested within. To make the dynamic scenario generation easier the AIO scenario conf setup has been moved into it's own variable file. The file doc/source/contributor/scenario-table-gen.html has been touched allowing sphinx to import and generate the required table as needed. Change-Id: Ief5d180491d3a330890d6bfa06d43f565dd26103 Signed-off-by: Kevin Carter --- doc/source/conf.py | 12 ++++ doc/source/contributor/quickstart-aio.rst | 6 ++ .../contributor/scenario-table-gen.html | 0 doc/source/scenario_table_gen.py | 69 +++++++++++++++++++ tests/bootstrap-aio.yml | 47 +------------ tests/vars/bootstrap-aio-vars.yml | 59 ++++++++++++++++ 6 files changed, 148 insertions(+), 45 deletions(-) create mode 100644 doc/source/contributor/scenario-table-gen.html create mode 100644 doc/source/scenario_table_gen.py create mode 100644 tests/vars/bootstrap-aio-vars.yml diff --git a/doc/source/conf.py b/doc/source/conf.py index 2d889a63a7..f4c66427d2 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -22,10 +22,22 @@ # All configuration values have a default; values that are commented out # serve to show the default. +import imp import os import pbr.version import sys +# Create dynamic table file. +CONF_PATH = os.path.dirname(os.path.realpath(__file__)) +SCENARIO_TABLE = 'contributor/scenario-table-gen.html' +TABLE_FILE = os.path.join(CONF_PATH, SCENARIO_TABLE) +stg = imp.load_source( + 'scenario_table_gen', + os.path.join(CONF_PATH, 'scenario_table_gen.py') +) +with open(TABLE_FILE, 'a+') as f: + f.write(stg.main()) + # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. diff --git a/doc/source/contributor/quickstart-aio.rst b/doc/source/contributor/quickstart-aio.rst index 3ad7c03965..753db08299 100644 --- a/doc/source/contributor/quickstart-aio.rst +++ b/doc/source/contributor/quickstart-aio.rst @@ -183,6 +183,12 @@ execute the following: # export SCENARIO='ceph' # scripts/bootstrap-aio.sh +**Tested Scenarios** + +.. raw:: html + :file: scenario-table-gen.html + + To add OpenStack Services over and above the `bootstrap-aio default services`_ for the applicable scenario, copy the ``conf.d`` files with the ``.aio`` file extension into ``/etc/openstack_deploy`` and rename then to ``.yml`` files. diff --git a/doc/source/contributor/scenario-table-gen.html b/doc/source/contributor/scenario-table-gen.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/doc/source/scenario_table_gen.py b/doc/source/scenario_table_gen.py new file mode 100644 index 0000000000..5bc743ea5e --- /dev/null +++ b/doc/source/scenario_table_gen.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python +# Copyright 2017, Rackspace US, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os + +import yaml + + +SCRIPT_PATH = os.path.dirname(os.path.realpath(__file__)) +SCENARIO_FILE = '../../tests/vars/bootstrap-aio-vars.yml' +HTML_TABLE = """""" + + +def main(): + scenario_file = os.path.join(SCRIPT_PATH, SCENARIO_FILE) + with open(scenario_file) as f: + _meta_data = yaml.safe_load(f.read()) + + scenario_meta_data = _meta_data['confd_overrides'] + scenarios = list(sorted(scenario_meta_data.keys())) + scenarios.insert(0, '') + HTML_TABLE = '
' + HTML_TABLE += '' + for s in scenarios: + HTML_TABLE += ''.format(s) + HTML_TABLE += '' + + config_items = set() + for items in scenario_meta_data.values(): + for item in items: + config_items.add(item['name'].split('.')[0]) + config_items = list(config_items) + + for item in config_items: + HTML_TABLE += '' + HTML_TABLE += ''.format(item.lower()) + for scenario in scenarios: + try: + scenario_meta = scenario_meta_data[scenario] + except KeyError: + pass + else: + for _items in scenario_meta: + if item == _items['name'].split('.')[0]: + HTML_TABLE += '' + break + else: + HTML_TABLE += '' + HTML_TABLE += '' + HTML_TABLE += '' + HTML_TABLE += '
{}
{}X 
' + + return HTML_TABLE + + +if __name__ == '__main__': + print(main()) diff --git a/tests/bootstrap-aio.yml b/tests/bootstrap-aio.yml index ef435e29df..882e918989 100644 --- a/tests/bootstrap-aio.yml +++ b/tests/bootstrap-aio.yml @@ -23,52 +23,8 @@ - role: "bootstrap-host" vars: ansible_python_interpreter: "/usr/bin/python" - openstack_confd_entries: "{{ confd_overrides[bootstrap_host_scenario] }}" bootstrap_host_scenario: "{{ lookup('env','SCENARIO') | default('aio', true) }}" - confd_overrides: - aio: - - name: cinder.yml.aio - - name: designate.yml.aio - - name: glance.yml.aio - - name: heat.yml.aio - - name: horizon.yml.aio - - name: keystone.yml.aio - - name: neutron.yml.aio - - name: nova.yml.aio - - name: swift.yml.aio - ceph: - - name: ceph.yml.aio - - name: cinder.yml.aio - - name: glance.yml.aio - - name: heat.yml.aio - - name: horizon.yml.aio - - name: keystone.yml.aio - - name: neutron.yml.aio - - name: nova.yml.aio - translations: - - name: cinder.yml.aio - - name: designate.yml.aio - - name: glance.yml.aio - - name: heat.yml.aio - - name: horizon.yml.aio - - name: keystone.yml.aio - - name: neutron.yml.aio - - name: nova.yml.aio - - name: swift.yml.aio - - name: sahara.yml.aio - - name: magnum.yml.aio - - name: octavia.yml.aio - - name: trove.yml.aio - octavia: - - name: glance.yml.aio - - name: keystone.yml.aio - - name: neutron.yml.aio - - name: nova.yml.aio - - name: octavia.yml.aio - tacker: - - name: keystone.yml.aio - - name: heat.yml.aio - - name: tacker.yml.aio + openstack_confd_entries: "{{ confd_overrides[bootstrap_host_scenario] }}" pip_install_upper_constraints_proto: "{{ ansible_python_version | version_compare('2.7.9', '>=') | ternary('https','http') }}" sftp_subsystem: 'apt': 'sftp /usr/lib/openssh/sftp-server' @@ -117,4 +73,5 @@ GSSAPICleanupCredentials: no vars_files: - "{{ playbook_dir }}/../playbooks/defaults/repo_packages/openstack_services.yml" + - vars/bootstrap-aio-vars.yml environment: "{{ deployment_environment_variables | default({}) }}" diff --git a/tests/vars/bootstrap-aio-vars.yml b/tests/vars/bootstrap-aio-vars.yml new file mode 100644 index 0000000000..5e5784797f --- /dev/null +++ b/tests/vars/bootstrap-aio-vars.yml @@ -0,0 +1,59 @@ +--- +# Copyright 2017, Rackspace US, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +confd_overrides: + aio: + - name: cinder.yml.aio + - name: designate.yml.aio + - name: glance.yml.aio + - name: heat.yml.aio + - name: horizon.yml.aio + - name: keystone.yml.aio + - name: neutron.yml.aio + - name: nova.yml.aio + - name: swift.yml.aio + ceph: + - name: ceph.yml.aio + - name: cinder.yml.aio + - name: glance.yml.aio + - name: heat.yml.aio + - name: horizon.yml.aio + - name: keystone.yml.aio + - name: neutron.yml.aio + - name: nova.yml.aio + translations: + - name: cinder.yml.aio + - name: designate.yml.aio + - name: glance.yml.aio + - name: heat.yml.aio + - name: horizon.yml.aio + - name: keystone.yml.aio + - name: neutron.yml.aio + - name: nova.yml.aio + - name: swift.yml.aio + - name: sahara.yml.aio + - name: magnum.yml.aio + - name: octavia.yml.aio + - name: trove.yml.aio + octavia: + - name: glance.yml.aio + - name: keystone.yml.aio + - name: neutron.yml.aio + - name: nova.yml.aio + - name: octavia.yml.aio + tacker: + - name: keystone.yml.aio + - name: heat.yml.aio + - name: tacker.yml.aio