Fix doc generation for Rackspace::Cloud::Network

Since contrib plugins may not be installed at the time the docs are
generated, the resource_mapping function needs to return all resource
types defined by the resource module.  To selectively load such resource
types - based on requirements being met, for instance, the
available_resource_mapping function should be used instead.

This makes the necessary changes to Rackspace::Cloud::Network so that
its docs are generated correctly.

Related-Bug: 1403897
Change-Id: I7c12c055924e7a16a5b9cc573d91c12089a2395d
This commit is contained in:
Anderson Mesquita 2014-12-16 15:10:18 -08:00
parent c762782284
commit 973b7ea6b7

View File

@ -24,17 +24,13 @@ from heat.openstack.common import log as logging
try:
from pyrax.exceptions import NotFound # noqa
PYRAX_INSTALLED = True
except ImportError:
PYRAX_INSTALLED = False
class NotFound(Exception):
"""Dummy pyrax exception - only used for testing."""
def resource_mapping():
return {}
else:
def resource_mapping():
return {'Rackspace::Cloud::Network': CloudNetwork}
LOG = logging.getLogger(__name__)
@ -137,3 +133,13 @@ class CloudNetwork(resource.Resource):
if net:
return unicode(getattr(net, name))
return ""
def resource_mapping():
return {'Rackspace::Cloud::Network': CloudNetwork}
def available_resource_mapping():
if PYRAX_INSTALLED:
return resource_mapping()
return {}