From 4e01540b9b7454d13eff2037b9a1a707d2220e28 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Wed, 12 Sep 2018 13:02:58 -0400 Subject: [PATCH] add a flag to indicate which projects have guides Some of the projects publish documentation but not using the project guide structure. Instead of requiring all projects listed to have a default guide, add a flag that defaults to True and that can be changed in the project data file(s). Also add a default field to the URLSettings structure. Change-Id: Ie2b6abafde5d4be85941fd977762bcbdf891d440 Signed-off-by: Doug Hellmann --- tools/www-generator.py | 19 +++++++++++++------ www/project-data/schema.yaml | 2 ++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/tools/www-generator.py b/tools/www-generator.py index 6bcb2a0cef..8896e65692 100755 --- a/tools/www-generator.py +++ b/tools/www-generator.py @@ -176,53 +176,62 @@ def _check_url(args): # a file list generated by the web server. URLSettings = collections.namedtuple( 'URLSettings', - ['flag_name', 'types', 'template'], + ['flag_name', 'types', 'template', 'default'], ) _URLS = [ URLSettings( - flag_name=None, + flag_name='has_project_guide', types=[], template='https://docs.openstack.org/{name}/{series}/index.html', + default=True, ), URLSettings( flag_name='has_install_guide', types=['service'], template='https://docs.openstack.org/{name}/{series}/install/index.html', # noqa + default=False, ), URLSettings( flag_name='has_admin_guide', types=['service'], template='https://docs.openstack.org/{name}/{series}/admin/index.html', + default=False, ), URLSettings( flag_name='has_config_ref', types=['service', 'library'], template='https://docs.openstack.org/{name}/{series}/configuration/index.html', # noqa + default=False, ), URLSettings( flag_name='has_in_tree_api_docs', types=['service'], template='https://docs.openstack.org/{name}/{series}/api/index.html', + default=False, ), URLSettings( flag_name='has_user_guide', types=['service'], template='https://docs.openstack.org/{name}/{series}/user/index.html', + default=False, ), URLSettings( flag_name='has_api_ref', types=['service'], template='https://developer.openstack.org/api-ref/{service_type}/index.html', # noqa + default=False, ), URLSettings( flag_name='has_api_guide', types=['service'], template='https://developer.openstack.org/api-guide/{service_type}/index.html', # noqa + default=False, ), URLSettings( flag_name='has_deployment_guide', types=['deployment'], template='https://docs.openstack.org/project-deploy-guide/{name}/{series}/index.html', # noqa + default=False, ), ] @@ -330,10 +339,8 @@ def load_project_data(source_directory, ) if check_links_this_project and not skip_links: for url_info in _URLS: - if url_info.flag_name is None: - flag_val = True - else: - flag_val = project.get(url_info.flag_name, False) + flag_val = project.get(url_info.flag_name, + url_info.default) if ((not flag_val) and url_info.types and project_type not in url_info.types): diff --git a/www/project-data/schema.yaml b/www/project-data/schema.yaml index 4edf4be444..b37f6e6879 100644 --- a/www/project-data/schema.yaml +++ b/www/project-data/schema.yaml @@ -48,3 +48,5 @@ items: type: boolean has_deployment_guide: type: boolean + has_project_guide: + type: boolean