Add a way to get the resources depended on by an output
Change-Id: Ib17de40c4289df58002ca982bf4f2e319993948d
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
import copy
|
import copy
|
||||||
import six
|
import six
|
||||||
|
|
||||||
|
from heat.common import exception
|
||||||
from heat.engine import function
|
from heat.engine import function
|
||||||
|
|
||||||
|
|
||||||
@@ -25,11 +26,24 @@ class OutputDefinition(object):
|
|||||||
self._value = value
|
self._value = value
|
||||||
self._resolved_value = None
|
self._resolved_value = None
|
||||||
self._description = description
|
self._description = description
|
||||||
|
self._deps = None
|
||||||
|
|
||||||
def validate(self, path=''):
|
def validate(self, path=''):
|
||||||
"""Validate the output value without resolving it."""
|
"""Validate the output value without resolving it."""
|
||||||
function.validate(self._value, path)
|
function.validate(self._value, path)
|
||||||
|
|
||||||
|
def required_resource_names(self):
|
||||||
|
if self._deps is None:
|
||||||
|
try:
|
||||||
|
required_resources = function.dependencies(self._value)
|
||||||
|
self._deps = set(six.moves.map(lambda rp: rp.name,
|
||||||
|
required_resources))
|
||||||
|
except (exception.InvalidTemplateAttribute,
|
||||||
|
exception.InvalidTemplateReference):
|
||||||
|
# This output ain't gonna work anyway
|
||||||
|
self._deps = set()
|
||||||
|
return self._deps
|
||||||
|
|
||||||
def dep_attrs(self, resource_name):
|
def dep_attrs(self, resource_name):
|
||||||
"""Iterate over attributes of a given resource that this references.
|
"""Iterate over attributes of a given resource that this references.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user