add service-type redirects

Templatize .htaccess file and generate the redirects for the service
type names to point to the service docs.

Add service_type to the projects.yaml file.

Change the template rendering code to only pass HTML templates through
BeautifulSoup.

Change-Id: I40438d5d56d112f33d9839af220994040bbd1bdb
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2017-06-21 16:08:26 -04:00
parent c4895c71ed
commit 459ab02aa3
3 changed files with 50 additions and 3 deletions

View File

@ -92,7 +92,8 @@ def main():
return 1
for templateFile in environment.list_templates():
if not templateFile.endswith('.html'):
if not (templateFile.endswith('.html')
or templateFile.endswith('.htaccess')):
logger.info('ignoring %s', templateFile)
continue
@ -107,8 +108,9 @@ def main():
try:
output = template.render(projects=project_data)
soup = BeautifulSoup(output, "lxml")
output = soup.prettify()
if templateFile.endswith('.html'):
soup = BeautifulSoup(output, "lxml")
output = soup.prettify()
except Exception as e:
logger.error("rendering template %s failed: %s" %
(templateFile, e))

View File

@ -541,3 +541,11 @@ redirectmatch 301 "^/infra/shade(.*)$" /developer/shade$1
# Redirecting old project developer docs to the new project home pages
# while leaving the index / project list page as it is.
redirectmatch 301 "^/developer/([^/]+)/.*$" /$1/latest/
# Redirects from service-type to code-name
{% for project in projects -%}
{%- if project.type == 'service' and project.service_type %}
redirectmatch 302 "^/{{project.service_type|lower}}/.*$" /{{project.name}}/latest/
{%- endif %}
{%- endfor %}
# End service-type redirects

View File

@ -11,6 +11,8 @@
# Python Bindings', or for non-client libraries a 1
# sentence description of the purpose of the library.
#
# service_type -- the official service type string for the project
#
# has_install_guide -- boolean indicating whether the project should
# be included list of installation guides
#
@ -21,6 +23,7 @@
- name: keystone
service: Identity service
service_type: identity
has_install_guide: true
type: service
- name: python-keystoneclient
@ -29,6 +32,7 @@
description: keystone client
- name: glance
service: Image service
service_type: image
has_install_guide: true
type: service
- name: python-glanceclient
@ -37,6 +41,7 @@
description: glance client
- name: nova
service: Compute service
service_type: compute
has_install_guide: true
type: service
- name: python-novaclient
@ -45,6 +50,7 @@
description: nova client
- name: neutron
service: Networking service
service_type: networking
has_install_guide: true
type: service
- name: python-neutronclient
@ -57,6 +63,7 @@
type: service
- name: cinder
service: Block Storage service
service_type: block-storage
has_install_guide: true
type: service
- name: python-cinderclient
@ -65,6 +72,7 @@
description: cinder client
- name: ironic
service: Bare Metal service
service_type: baremetal
has_install_guide: true
type: service
- name: python-ironicclient
@ -73,6 +81,7 @@
description: ironic client
- name: magnum
service: Container Infrastructure Management service
service_type: container-infrastructure-management
has_install_guide: true
type: service
- name: python-magnumclient
@ -81,6 +90,7 @@
description: magnum client
- name: trove
service: Database service
service_type: database
has_install_guide: true
type: service
- name: python-troveclient
@ -89,6 +99,7 @@
description: trove client
- name: designate
service: DNS service
service_type: dns
has_install_guide: true
type: service
- name: python-designateclient
@ -97,10 +108,12 @@
description: designate client
- name: ec2-api
service: EC2 API compatibility layer
service_type: ec2-api
has_install_guide: true
type: service
- name: barbican
service: Key Manager service
service_type: key-manager
has_install_guide: true
type: service
- name: python-barbicanclient
@ -109,6 +122,7 @@
description: barbican client
- name: zaqar
service: Messaging service
service_type: messaging
has_install_guide: true
type: service
- name: python-zaqarclient
@ -117,6 +131,7 @@
description: zaqar client
- name: swift
service: Object Storage service
service_type: object-store
has_install_guide: true
type: service
- name: python-swiftclient
@ -125,6 +140,7 @@
description: swift client
- name: heat
service: Orchestration service
service_type: orchestration
has_install_guide: true
type: service
- name: python-heatclient
@ -133,6 +149,7 @@
description: heat client
- name: manila
service: Shared File Systems service
service_type: shared-file-system
has_install_guide: true
type: service
- name: python-manilaclient
@ -141,6 +158,7 @@
description: manila client
- name: aodh
service: Telemetry Alarming services
service_type: alarm
has_install_guide: true
type: service
- name: python-aodhclient
@ -149,6 +167,7 @@
description: aodh client
- name: ceilometer
service: Telemetry Data Collection service
service_type: meter
has_install_guide: true
type: service
- name: python-ceilometerclient
@ -157,6 +176,7 @@
description: ceilometer client
- name: sahara
service: Data Processing service
service_type: data-processing
has_install_guide: false
type: service
- name: python-saharaclient
@ -165,18 +185,25 @@
description: sahara client
- name: congress
service: Governance service
service_type: operator-policy
type: service
has_install_guide: false
- name: python-congressclient
service: Governance service Python Bindings
type: client
description: congress client
- name: watcher
service: Infrastructure Optimization service
service_type: resource-optimization
type: service
has_install_guide: false
- name: python-watcherclient
service: Infrastructure Optimization service Python Bindings
type: client
description: watcher client
- name: mistral
service: Workflow service
service_type: workflow
type: service
has_install_guide: false
- name: python-mistralclient
@ -185,6 +212,7 @@
description: mistral client
- name: murano
service: Application Catalog service
service_type: application-catalog
type: service
has_install_guide: false
- name: python-muranoclient
@ -193,6 +221,7 @@
description: murano client
- name: senlin
service: Clustering service
service_type: resource-cluster
type: service
has_install_guide: false
- name: python-senlinclient
@ -205,6 +234,7 @@
has_install_guide: false
- name: zun
service: Containers service
service_type: application-container
type: service
has_install_guide: false
- name: python-zunclient
@ -213,6 +243,7 @@
description: zun client
- name: tacker
service: NFV Orchestration service
service_type: nfv-orchestration
type: service
has_install_guide: false
- name: python-tackerclient
@ -221,6 +252,7 @@
description: tacker client
- name: cloudkitty
service: Rating service
service_type: rating
type: service
has_install_guide: false
- name: python-cloudkittyclient
@ -229,6 +261,7 @@
description: cloudkitty client
- name: vitrage
service: RCA (Root Cause Analysis) service
service_type: root-cause-analysis
type: service
has_install_guide: false
- name: python-vitrageclient
@ -237,6 +270,9 @@
description: vitrage client
- name: searchlight
service: Search service
# NOTE(dhellmann): This causes /search/ to redirect to the
# searchlight documentation.
service_type: search
type: service
has_install_guide: false
- name: python-searchlightclient
@ -245,6 +281,7 @@
description: searchlight client
- name: panko
service: Telemetry Event service
service_type: event
type: service
has_install_guide: false
- name: python-pankoclient