Merge "only check links associated with the project type"

This commit is contained in:
Jenkins 2017-08-07 10:08:52 +00:00 committed by Gerrit Code Review
commit 74c4fbd4a5

View File

@ -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: