From a85dab5668fbe4ac727cbe5b6d784db37442042c Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Sat, 5 Aug 2017 15:17:33 -0400 Subject: [PATCH] only check links associated with the project type When using www-generator.py with --check-all-links we don't want to look for links that we do not expect to find or want to use. Limit the URLs checked by the project type in that case. Change-Id: I7560ec5d57d564730ebe60957153ea63f58002f8 Signed-off-by: Doug Hellmann --- tools/www-generator.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/tools/www-generator.py b/tools/www-generator.py index c0ace8e4ff..41877a5203 100755 --- a/tools/www-generator.py +++ b/tools/www-generator.py @@ -160,21 +160,21 @@ def _check_url(args): # a real page is published to the location, and we are not retrieving # a file list generated by the web server. _URLS = [ - (None, + (None, [], 'https://docs.openstack.org/{name}/{series}/index.html'), - ('has_install_guide', + ('has_install_guide', ['service'], 'https://docs.openstack.org/{name}/{series}/install/index.html'), - ('has_admin_guide', + ('has_admin_guide', ['service'], 'https://docs.openstack.org/{name}/{series}/admin/index.html'), - ('has_config_ref', + ('has_config_ref', ['service', 'library'], 'https://docs.openstack.org/{name}/{series}/configuration/index.html'), - ('has_in_tree_api_docs', + ('has_in_tree_api_docs', ['service'], 'https://docs.openstack.org/{name}/{series}/api/index.html'), - ('has_user_guide', + ('has_user_guide', ['service'], 'https://docs.openstack.org/{name}/{series}/user/index.html'), - ('has_api_ref', + ('has_api_ref', ['service'], 'https://developer.openstack.org/api-ref/{service_type}/index.html'), - ('has_api_guide', + ('has_api_guide', ['service'], 'https://developer.openstack.org/api-guide/{service_type}/index.html'), ] @@ -261,11 +261,16 @@ def load_project_data(source_directory, # If the project claims to have a separately published guide # of some sort, look for it before allowing the flag to stand. if not skip_links: - for flag, url_template in _URLS: + for flag, types, url_template in _URLS: if flag is None: flag_val = True else: flag_val = project.get(flag, False) + if (not flag_val) and types and project_type not in types: + # This type of project isn't expected to have + # this type of link, so if we are not + # explicitly told to check for it don't. + continue try: url = url_template.format(series=series, **project) except KeyError: