Merge "Add unsupported resources page to documentation"

This commit is contained in:
Jenkins 2015-05-30 21:36:32 +00:00 committed by Gerrit Code Review
commit 82ebcbc90a
3 changed files with 51 additions and 4 deletions

View File

@ -38,6 +38,10 @@ class integratedrespages(nodes.General, nodes.Element):
pass
class unsupportedrespages(nodes.General, nodes.Element):
pass
class contribresourcepages(nodes.General, nodes.Element):
pass
@ -52,11 +56,14 @@ class ResourcePages(compat.Directive):
def path(self):
return None
def statuses(self):
return support.SUPPORT_STATUSES
def run(self):
prefix = self.arguments and self.arguments.pop() or None
content = []
for resource_type, resource_classes in _filter_resources(prefix,
self.path()):
for resource_type, resource_classes in _filter_resources(
prefix, self.path(), self.statuses()):
for resource_class in resource_classes:
self.resource_type = resource_type
self.resource_class = resource_class
@ -337,6 +344,18 @@ class IntegrateResourcePages(ResourcePages):
def path(self):
return 'heat.engine.resources'
def statuses(self):
return [support.SUPPORTED]
class UnsupportedResourcePages(ResourcePages):
def path(self):
return 'heat.engine.resources'
def statuses(self):
return [s for s in support.SUPPORT_STATUSES if s != support.SUPPORTED]
class ContribResourcePages(ResourcePages):
@ -344,18 +363,21 @@ class ContribResourcePages(ResourcePages):
return 'heat.engine.plugins'
def _filter_resources(prefix=None, path=None):
def _filter_resources(prefix=None, path=None, statuses=[]):
def prefix_match(name):
return prefix is None or name.startswith(prefix)
def path_match(cls):
return path is None or cls.__module__.startswith(path)
def status_match(cls):
return cls.support_status.status in statuses
filtered_resources = {}
for name in sorted(six.iterkeys(all_resources)):
if prefix_match(name):
for cls in all_resources.get(name):
if path_match(cls):
if path_match(cls) and status_match(cls):
if filtered_resources.get(name) is not None:
filtered_resources[name].append(cls)
else:
@ -383,6 +405,10 @@ def setup(app):
app.add_directive('integratedrespages', IntegrateResourcePages)
app.add_node(unsupportedrespages)
app.add_directive('unsupportedrespages', UnsupportedResourcePages)
app.add_node(contribresourcepages)
app.add_directive('contribrespages', ContribResourcePages)

View File

@ -23,5 +23,6 @@ Template Guide
composition
openstack
cfn
unsupported
contrib
functions

View File

@ -0,0 +1,20 @@
..
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
Unsupported Heat Resource Types
===============================
.. rubric:: These resources are enabled, but are not officially supported.
.. unsupportedrespages::