summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorhuangtianhua <huangtianhua@huawei.com>2017-03-29 10:55:59 +0800
committerDavid Peacock <david.j.peacock@gmail.com>2019-12-23 17:15:03 +0000
commit6c48f4d03b9506c52bfa8cb0e764b91de7d68f06 (patch)
tree821c0a5939930e18c56cc208f901d198eef0813c /doc
parent28ce9f3ad42e1a4713dea845bcc4bdc5a6d08fb9 (diff)
downloadheat-6c48f4d03b9506c52bfa8cb0e764b91de7d68f06.tar.gz
Update the default implementation of _show_resource
Give the latest implementation of Resource's _show_resource in pluginguide.rst. Change-Id: I21162d68398980d1a7b2cfae9bfe051855b39269
Diffstat (limited to 'doc')
-rw-r--r--doc/source/developing_guides/pluginguide.rst15
1 files changed, 9 insertions, 6 deletions
diff --git a/doc/source/developing_guides/pluginguide.rst b/doc/source/developing_guides/pluginguide.rst
index 8b3816209..d8d43345a 100644
--- a/doc/source/developing_guides/pluginguide.rst
+++ b/doc/source/developing_guides/pluginguide.rst
@@ -347,16 +347,19 @@ overridden:
"""Default implementation; should be overridden by resources.
:returns: the map of resource information or None
- """
+ """
if self.entity:
try:
obj = getattr(self.client(), self.entity)
resource = obj.get(self.resource_id)
- return resource.to_dict()
- except AttributeError as ex:
- LOG.warning(_LW("Resolving 'show' attribute has "
- "failed : %s"), ex)
- return None
+ if isinstance(resource, dict):
+ return resource
+ else:
+ return resource.to_dict()
+ except AttributeError as ex:
+ LOG.warning("Resolving 'show' attribute has failed : %s",
+ ex)
+ return None
Property and Attribute Example
******************************