ensure that projects actually have guides
Add validation so that we do not set flags for external guides true for projects that do not have them published. Change-Id: I34b1bd28adeddb0509feddf0da6743cb7a24f3f2 Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
parent
4426008ee2
commit
95712acc0c
@ -21,6 +21,7 @@ import sys
|
||||
from bs4 import BeautifulSoup
|
||||
import jinja2
|
||||
import jsonschema
|
||||
import requests
|
||||
import yaml
|
||||
|
||||
|
||||
@ -56,6 +57,22 @@ def parse_command_line_arguments():
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def _check_url(url):
|
||||
"Return True if the URL exists, False otherwise."
|
||||
resp = requests.get(url)
|
||||
return (resp.status_code // 100) == 2, resp.status_code
|
||||
|
||||
|
||||
_URLS = [
|
||||
('has_install_guide',
|
||||
'https://docs.openstack.org/{name}/{series}/install/'),
|
||||
('has_api_ref',
|
||||
'https://developer.openstack.org/api-ref/{service_type}/'),
|
||||
('has_api_guide',
|
||||
'https://developer.openstack.org/api-guide/{service_type}/'),
|
||||
]
|
||||
|
||||
|
||||
def load_project_data(source_directory):
|
||||
"Return a dict with project data grouped by series."
|
||||
logger = logging.getLogger()
|
||||
@ -82,6 +99,21 @@ def load_project_data(source_directory):
|
||||
for error in validator.iter_errors(data):
|
||||
logger.error(str(error))
|
||||
fail = True
|
||||
# If the project claims to have a separately published guide
|
||||
# of some sort, look for it before allowing the flag to stand.
|
||||
for project in data:
|
||||
for flag, url_template in _URLS:
|
||||
if project.get(flag):
|
||||
url = url_template.format(series=series, **project)
|
||||
logger.info('%s:%s looking for %s',
|
||||
series, project['name'], url)
|
||||
exists, status = _check_url(url)
|
||||
if not exists:
|
||||
logger.error(
|
||||
'%s set for %s but %s does not exist (%s)',
|
||||
flag, project['name'], url, status,
|
||||
)
|
||||
fail = True
|
||||
if fail:
|
||||
raise ValueError('invalid input in %s' % filename)
|
||||
project_data[series] = data
|
||||
|
@ -58,7 +58,7 @@
|
||||
- name: nova
|
||||
service: Compute service
|
||||
service_type: compute
|
||||
has_install_guide: true
|
||||
# has_install_guide: true
|
||||
has_api_ref: true
|
||||
type: service
|
||||
- name: python-novaclient
|
||||
@ -69,7 +69,7 @@
|
||||
- name: neutron
|
||||
service: Networking service
|
||||
service_type: networking
|
||||
has_install_guide: true
|
||||
# has_install_guide: true
|
||||
has_api_ref: true
|
||||
type: service
|
||||
- name: python-neutronclient
|
||||
@ -110,7 +110,7 @@
|
||||
- name: magnum
|
||||
service: Container Infrastructure Management service
|
||||
service_type: container-infrastructure-management
|
||||
has_install_guide: true
|
||||
# has_install_guide: true
|
||||
type: service
|
||||
- name: python-magnumclient
|
||||
service: Container Infrastructure Management service Python Bindings
|
||||
@ -120,7 +120,7 @@
|
||||
- name: trove
|
||||
service: Database service
|
||||
service_type: database
|
||||
has_install_guide: true
|
||||
# has_install_guide: true
|
||||
type: service
|
||||
- name: python-troveclient
|
||||
service: Database service Python Bindings
|
||||
@ -130,7 +130,7 @@
|
||||
- name: designate
|
||||
service: DNS service
|
||||
service_type: dns
|
||||
has_install_guide: true
|
||||
# has_install_guide: true
|
||||
type: service
|
||||
- name: python-designateclient
|
||||
service: DNS service Python Bindings
|
||||
@ -140,7 +140,7 @@
|
||||
- name: ec2-api
|
||||
service: EC2 API compatibility layer
|
||||
service_type: ec2-api
|
||||
has_install_guide: true
|
||||
# has_install_guide: true
|
||||
type: service
|
||||
|
||||
- name: barbican
|
||||
@ -157,7 +157,7 @@
|
||||
- name: zaqar
|
||||
service: Messaging service
|
||||
service_type: messaging
|
||||
has_install_guide: true
|
||||
# has_install_guide: true
|
||||
type: service
|
||||
- name: python-zaqarclient
|
||||
service: Messaging service Python Bindings
|
||||
@ -166,8 +166,8 @@
|
||||
|
||||
- name: swift
|
||||
service: Object Storage service
|
||||
service_type: object-store
|
||||
has_install_guide: true
|
||||
service_type: object-storage
|
||||
# has_install_guide: true
|
||||
has_api_ref: true
|
||||
type: service
|
||||
- name: python-swiftclient
|
||||
@ -178,7 +178,7 @@
|
||||
- name: heat
|
||||
service: Orchestration service
|
||||
service_type: orchestration
|
||||
has_install_guide: true
|
||||
# has_install_guide: true
|
||||
type: service
|
||||
- name: python-heatclient
|
||||
service: Orchestration service Python Bindings
|
||||
@ -188,7 +188,7 @@
|
||||
- name: manila
|
||||
service: Shared File Systems service
|
||||
service_type: shared-file-system
|
||||
has_install_guide: true
|
||||
# has_install_guide: true
|
||||
type: service
|
||||
- name: python-manilaclient
|
||||
service: Shared File Systems service Python Bindings
|
||||
@ -198,7 +198,7 @@
|
||||
- name: aodh
|
||||
service: Telemetry Alarming services
|
||||
service_type: alarm
|
||||
has_install_guide: true
|
||||
# has_install_guide: true
|
||||
type: service
|
||||
- name: python-aodhclient
|
||||
service: Telemetry Alarming service Python Bindings
|
||||
|
Loading…
x
Reference in New Issue
Block a user