Fix resources allocation in documentation
Allocation of contributed resources generates incorrectly, so this patch fixes res allocation. Now contributed resources are in Contributed Heat Resource Types page and integrated are in OpenStack Resource Types page. Escaping from using env because of all_resources loaded from PluginMapping. Change-Id: I6d7c501f231c546f909c3ed7f19fc8d1fc04e927 Closes-bug: #1433675
This commit is contained in:
parent
17dc00ce33
commit
a871b70be9
@ -20,46 +20,7 @@ from heat.engine import support
|
|||||||
|
|
||||||
|
|
||||||
class KeystoneGroup(role_assignments.KeystoneRoleAssignment):
|
class KeystoneGroup(role_assignments.KeystoneRoleAssignment):
|
||||||
'''
|
"""Heat Template Resource for Keystone Group."""
|
||||||
Heat Template Resource for Keystone Group.
|
|
||||||
|
|
||||||
heat_template_version: 2013-05-23
|
|
||||||
|
|
||||||
description: Sample Keystone Group template
|
|
||||||
|
|
||||||
parameters:
|
|
||||||
group_name:
|
|
||||||
type: string
|
|
||||||
description: Keystone group name
|
|
||||||
group_description:
|
|
||||||
type: string
|
|
||||||
description: Keystone group description
|
|
||||||
group_domain:
|
|
||||||
type: string
|
|
||||||
description: Keystone group domain name
|
|
||||||
group_role:
|
|
||||||
type: string
|
|
||||||
description: role
|
|
||||||
group_role_domain:
|
|
||||||
type: string
|
|
||||||
description: group role domain
|
|
||||||
group_role_project:
|
|
||||||
type: string
|
|
||||||
description: group role project
|
|
||||||
|
|
||||||
resources:
|
|
||||||
admin_group:
|
|
||||||
type: OS::Keystone::Group
|
|
||||||
properties:
|
|
||||||
name: {get_param: group_name}
|
|
||||||
domain: {get_param: group_domain}
|
|
||||||
description: {get_param: group_description}
|
|
||||||
roles:
|
|
||||||
- role: {get_param: group_role}
|
|
||||||
domain: {get_param: group_role_domain}
|
|
||||||
- role: {get_param: group_role}
|
|
||||||
project: {get_param: group_role_project}
|
|
||||||
'''
|
|
||||||
|
|
||||||
support_status = support.SupportStatus(
|
support_status = support.SupportStatus(
|
||||||
version='2015.1',
|
version='2015.1',
|
||||||
|
@ -19,37 +19,7 @@ from heat.engine import support
|
|||||||
|
|
||||||
|
|
||||||
class KeystoneProject(resource.Resource):
|
class KeystoneProject(resource.Resource):
|
||||||
'''
|
"""Heat Template Resource for Keystone Project."""
|
||||||
Heat Template Resource for Keystone Project.
|
|
||||||
|
|
||||||
heat_template_version: 2013-05-23
|
|
||||||
|
|
||||||
description: Sample Keystone Project template
|
|
||||||
|
|
||||||
parameters:
|
|
||||||
project_name:
|
|
||||||
type: string
|
|
||||||
description: Keystone project name
|
|
||||||
project_description:
|
|
||||||
type: string
|
|
||||||
description: Keystone project description
|
|
||||||
project_enabled:
|
|
||||||
type: boolean
|
|
||||||
description: Keystone project is enabled or disabled
|
|
||||||
project_domain:
|
|
||||||
type: string
|
|
||||||
description: Keystone project domain name or id
|
|
||||||
|
|
||||||
resources:
|
|
||||||
admin_project:
|
|
||||||
type: OS::Keystone::Project
|
|
||||||
properties:
|
|
||||||
name: {get_param: project_name}
|
|
||||||
domain: {get_param: project_domain}
|
|
||||||
description: {get_param: project_description}
|
|
||||||
enabled: {get_param: project_enabled}
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
support_status = support.SupportStatus(
|
support_status = support.SupportStatus(
|
||||||
version='2015.1',
|
version='2015.1',
|
||||||
|
@ -18,22 +18,7 @@ from heat.engine import support
|
|||||||
|
|
||||||
|
|
||||||
class KeystoneRole(resource.Resource):
|
class KeystoneRole(resource.Resource):
|
||||||
'''
|
"""Heat Template Resource for Keystone Role."""
|
||||||
Heat Template Resource for Keystone Role.
|
|
||||||
|
|
||||||
heat_template_version: 2013-05-23
|
|
||||||
|
|
||||||
parameters:
|
|
||||||
role_name:
|
|
||||||
type: string
|
|
||||||
description: Keystone role name
|
|
||||||
|
|
||||||
resources:
|
|
||||||
sample_role:
|
|
||||||
type: OS::Keystone::Role
|
|
||||||
properties:
|
|
||||||
name: {get_param: role_name}
|
|
||||||
'''
|
|
||||||
|
|
||||||
support_status = support.SupportStatus(
|
support_status = support.SupportStatus(
|
||||||
version='2015.1',
|
version='2015.1',
|
||||||
|
@ -20,66 +20,7 @@ from heat.engine import support
|
|||||||
|
|
||||||
|
|
||||||
class KeystoneUser(role_assignments.KeystoneRoleAssignment):
|
class KeystoneUser(role_assignments.KeystoneRoleAssignment):
|
||||||
'''
|
"""Heat Template Resource for Keystone User."""
|
||||||
Heat Template Resource for Keystone User.
|
|
||||||
|
|
||||||
heat_template_version: 2013-05-23
|
|
||||||
|
|
||||||
description: Sample Keystone User template
|
|
||||||
|
|
||||||
parameters:
|
|
||||||
user_name:
|
|
||||||
type: string
|
|
||||||
description: Keystone user name
|
|
||||||
user_description:
|
|
||||||
type: string
|
|
||||||
description: Keystone user description
|
|
||||||
user_enabled:
|
|
||||||
type: boolean
|
|
||||||
description: Keystone user is enabled or disabled
|
|
||||||
user_domain:
|
|
||||||
type: string
|
|
||||||
description: Keystone user domain name
|
|
||||||
user_email:
|
|
||||||
type: string
|
|
||||||
description: Keystone user email address
|
|
||||||
user_password:
|
|
||||||
type: string
|
|
||||||
description: Keystone user password
|
|
||||||
user_default_project:
|
|
||||||
type: string
|
|
||||||
description: Keystone user default project id
|
|
||||||
user_groups:
|
|
||||||
type: comma_delimited_list
|
|
||||||
description: Keystone groups, where this user is part of
|
|
||||||
group_role:
|
|
||||||
type: string
|
|
||||||
description: role
|
|
||||||
group_role_domain:
|
|
||||||
type: string
|
|
||||||
description: group role domain
|
|
||||||
group_role_project:
|
|
||||||
type: string
|
|
||||||
description: group role project
|
|
||||||
|
|
||||||
resources:
|
|
||||||
admin_user:
|
|
||||||
type: OS::Keystone::User
|
|
||||||
properties:
|
|
||||||
name: {get_param: user_name}
|
|
||||||
domain: {get_param: user_domain}
|
|
||||||
description: {get_param: user_description}
|
|
||||||
enabled: {get_param: user_enabled}
|
|
||||||
email: {get_param: user_email}
|
|
||||||
password: {get_param: user_password}
|
|
||||||
default_project: {get_param: user_default_project}
|
|
||||||
groups: {get_param: user_groups}
|
|
||||||
roles:
|
|
||||||
- role: {get_param: group_role}
|
|
||||||
domain: {get_param: group_role_domain}
|
|
||||||
- role: {get_param: group_role}
|
|
||||||
project: {get_param: group_role_project}
|
|
||||||
'''
|
|
||||||
|
|
||||||
support_status = support.SupportStatus(
|
support_status = support.SupportStatus(
|
||||||
version='2015.1',
|
version='2015.1',
|
||||||
|
@ -29,7 +29,11 @@ LOG = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
class CloudServer(server.Server):
|
class CloudServer(server.Server):
|
||||||
"""Resource for Rackspace Cloud Servers."""
|
"""Resource for Rackspace Cloud Servers.
|
||||||
|
|
||||||
|
This resource overloads existent integrated OS::Nova::Server resource and
|
||||||
|
is used for Rackspace Cloud Servers.
|
||||||
|
"""
|
||||||
|
|
||||||
# Managed Cloud automation statuses
|
# Managed Cloud automation statuses
|
||||||
MC_STATUS_IN_PROGRESS = 'In Progress'
|
MC_STATUS_IN_PROGRESS = 'In Progress'
|
||||||
|
@ -17,24 +17,27 @@ import itertools
|
|||||||
from docutils import core
|
from docutils import core
|
||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
import pydoc
|
import pydoc
|
||||||
|
import six
|
||||||
from sphinx.util import compat
|
from sphinx.util import compat
|
||||||
|
|
||||||
from heat.common.i18n import _
|
from heat.common.i18n import _
|
||||||
from heat.engine import attributes
|
from heat.engine import attributes
|
||||||
from heat.engine import environment
|
|
||||||
from heat.engine import plugin_manager
|
from heat.engine import plugin_manager
|
||||||
from heat.engine import properties
|
from heat.engine import properties
|
||||||
from heat.engine import resources
|
|
||||||
from heat.engine import support
|
from heat.engine import support
|
||||||
|
|
||||||
_CODE_NAMES = {'2014.1': 'Icehouse',
|
_CODE_NAMES = {'2014.1': 'Icehouse',
|
||||||
'2014.2': 'Juno',
|
'2014.2': 'Juno',
|
||||||
'2015.1': 'Kilo'}
|
'2015.1': 'Kilo'}
|
||||||
|
|
||||||
global_env = environment.Environment({}, user_env=False)
|
all_resources = {}
|
||||||
|
|
||||||
|
|
||||||
class resourcepages(nodes.General, nodes.Element):
|
class integratedrespages(nodes.General, nodes.Element):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class contribresourcepages(nodes.General, nodes.Element):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@ -45,10 +48,15 @@ class ResourcePages(compat.Directive):
|
|||||||
final_argument_whitespace = False
|
final_argument_whitespace = False
|
||||||
option_spec = {}
|
option_spec = {}
|
||||||
|
|
||||||
|
def path(self):
|
||||||
|
return None
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
prefix = self.arguments and self.arguments.pop() or None
|
prefix = self.arguments and self.arguments.pop() or None
|
||||||
content = []
|
content = []
|
||||||
for resource_type, resource_class in _all_resources(prefix):
|
for resource_type, resource_classes in _filter_resources(prefix,
|
||||||
|
self.path()):
|
||||||
|
for resource_class in resource_classes:
|
||||||
self.resource_type = resource_type
|
self.resource_type = resource_type
|
||||||
self.resource_class = resource_class
|
self.resource_class = resource_class
|
||||||
section = self._section(content, resource_type, '%s')
|
section = self._section(content, resource_type, '%s')
|
||||||
@ -323,18 +331,36 @@ Resources:
|
|||||||
definition.append(def_para)
|
definition.append(def_para)
|
||||||
|
|
||||||
|
|
||||||
def _all_resources(prefix=None):
|
class IntegrateResourcePages(ResourcePages):
|
||||||
type_names = sorted(global_env.get_types())
|
|
||||||
if prefix is not None:
|
def path(self):
|
||||||
|
return 'heat.engine.resources'
|
||||||
|
|
||||||
|
|
||||||
|
class ContribResourcePages(ResourcePages):
|
||||||
|
|
||||||
|
def path(self):
|
||||||
|
return 'heat.engine.plugins'
|
||||||
|
|
||||||
|
|
||||||
|
def _filter_resources(prefix=None, path=None):
|
||||||
def prefix_match(name):
|
def prefix_match(name):
|
||||||
return name.startswith(prefix)
|
return prefix is None or name.startswith(prefix)
|
||||||
|
|
||||||
type_names = itertools.ifilter(prefix_match, type_names)
|
def path_match(cls):
|
||||||
|
return path is None or cls.__module__.startswith(path)
|
||||||
|
|
||||||
def resource_type(name):
|
filtered_resources = {}
|
||||||
return name, global_env.get_class(name)
|
for name in sorted(all_resources.keys()):
|
||||||
|
if prefix_match(name):
|
||||||
|
for cls in all_resources.get(name):
|
||||||
|
if path_match(cls):
|
||||||
|
if filtered_resources.get(name) is not None:
|
||||||
|
filtered_resources[name].append(cls)
|
||||||
|
else:
|
||||||
|
filtered_resources[name] = [cls]
|
||||||
|
|
||||||
return itertools.imap(resource_type, type_names)
|
return sorted(six.iteritems(filtered_resources))
|
||||||
|
|
||||||
|
|
||||||
def _load_all_resources():
|
def _load_all_resources():
|
||||||
@ -342,12 +368,20 @@ def _load_all_resources():
|
|||||||
resource_mapping = plugin_manager.PluginMapping('resource')
|
resource_mapping = plugin_manager.PluginMapping('resource')
|
||||||
res_plugin_mappings = resource_mapping.load_all(manager)
|
res_plugin_mappings = resource_mapping.load_all(manager)
|
||||||
|
|
||||||
resources._register_resources(global_env, res_plugin_mappings)
|
for mapping in res_plugin_mappings:
|
||||||
environment.read_global_environment(global_env)
|
name, cls = mapping
|
||||||
|
if all_resources.get(name) is not None:
|
||||||
|
all_resources[name].append(cls)
|
||||||
|
else:
|
||||||
|
all_resources[name] = [cls]
|
||||||
|
|
||||||
|
|
||||||
def setup(app):
|
def setup(app):
|
||||||
_load_all_resources()
|
_load_all_resources()
|
||||||
app.add_node(resourcepages)
|
app.add_node(integratedrespages)
|
||||||
|
|
||||||
app.add_directive('resourcepages', ResourcePages)
|
app.add_directive('integratedrespages', IntegrateResourcePages)
|
||||||
|
|
||||||
|
app.add_node(contribresourcepages)
|
||||||
|
|
||||||
|
app.add_directive('contribrespages', ContribResourcePages)
|
||||||
|
@ -13,4 +13,4 @@
|
|||||||
|
|
||||||
CloudFormation Compatible Resource Types
|
CloudFormation Compatible Resource Types
|
||||||
----------------------------------------
|
----------------------------------------
|
||||||
.. resourcepages:: AWS::
|
.. integratedrespages:: AWS::
|
||||||
|
@ -14,6 +14,11 @@
|
|||||||
Contributed Heat Resource Types
|
Contributed Heat Resource Types
|
||||||
===============================
|
===============================
|
||||||
|
|
||||||
|
.. rubric:: These resources are not enabled by default.
|
||||||
|
|
||||||
|
.. contribrespages:: OS::
|
||||||
|
|
||||||
|
|
||||||
Rackspace Cloud Resource Types
|
Rackspace Cloud Resource Types
|
||||||
------------------------------
|
------------------------------
|
||||||
|
|
||||||
@ -31,7 +36,7 @@ properly. More information about them can be found in the
|
|||||||
<https://github.com/openstack/heat/blob/master/contrib/rackspace/README.md>`_.
|
<https://github.com/openstack/heat/blob/master/contrib/rackspace/README.md>`_.
|
||||||
|
|
||||||
|
|
||||||
.. resourcepages:: Rackspace::
|
.. contribrespages:: Rackspace::
|
||||||
|
|
||||||
|
|
||||||
DockerInc Resource
|
DockerInc Resource
|
||||||
@ -44,16 +49,4 @@ requires the `docker-py <https://pypi.python.org/pypi/docker-py>`_
|
|||||||
package. You can find more information in the `DOCKER_README
|
package. You can find more information in the `DOCKER_README
|
||||||
<https://github.com/openstack/heat/blob/master/contrib/heat_docker/README.md>`_.
|
<https://github.com/openstack/heat/blob/master/contrib/heat_docker/README.md>`_.
|
||||||
|
|
||||||
.. resourcepages:: DockerInc::
|
.. contribrespages:: DockerInc::
|
||||||
|
|
||||||
Nova Flavor Resource
|
|
||||||
--------------------
|
|
||||||
|
|
||||||
.. rubric:: This resource is not enabled by default.
|
|
||||||
|
|
||||||
This plugin enables dynamic creation of Nova flavors through Heat. You can
|
|
||||||
find more information in the `NOVA_FLAVOR_README
|
|
||||||
<https://github.com/openstack/heat/blob/master/contrib/nova_flavor
|
|
||||||
/README.md>`_.
|
|
||||||
|
|
||||||
.. resourcepages:: OS::Nova::Flavor
|
|
||||||
|
@ -14,4 +14,4 @@
|
|||||||
|
|
||||||
OpenStack Resource Types
|
OpenStack Resource Types
|
||||||
------------------------
|
------------------------
|
||||||
.. resourcepages:: OS::
|
.. integratedrespages:: OS::
|
||||||
|
Loading…
Reference in New Issue
Block a user