diff options
author | Jenkins <jenkins@review.openstack.org> | 2014-07-28 02:17:19 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2014-07-28 02:17:19 +0000 |
commit | 21abdc026daeff89251768e3e872c7b2aefaa387 (patch) | |
tree | e5fd8fdd879941cf2dc50f91ef24c7bbbfb1d58b /heat/engine/hot | |
parent | 378e0736f747e2f61a816c31fb1d4869a2827094 (diff) | |
parent | cacdb4799326358939ec347696526df0bf6291db (diff) | |
download | heat-21abdc026daeff89251768e3e872c7b2aefaa387.tar.gz |
Merge "Refactor selecting values from an attribute"
Diffstat (limited to 'heat/engine/hot')
-rw-r--r-- | heat/engine/hot/functions.py | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/heat/engine/hot/functions.py b/heat/engine/hot/functions.py index 3c7e5d8f7..84bd05aab 100644 --- a/heat/engine/hot/functions.py +++ b/heat/engine/hot/functions.py @@ -14,6 +14,7 @@ import collections from heat.common import exception +from heat.engine import attributes from heat.engine.cfn import functions as cfn_funcs from heat.engine import function @@ -116,22 +117,7 @@ class GetAtt(cfn_funcs.GetAtt): return None path_components = function.resolve(self._path_components) - - def get_path_component(collection, key): - if not isinstance(collection, (collections.Mapping, - collections.Sequence)): - raise TypeError(_('"%s" can\'t traverse path') % self.fn_name) - - if not isinstance(key, (basestring, int)): - raise TypeError(_('Path components in "%s" ' - 'must be strings') % self.fn_name) - - return collection[key] - - try: - return reduce(get_path_component, path_components, attribute) - except (KeyError, IndexError, TypeError): - return None + return attributes.select_from_attribute(attribute, path_components) class Replace(cfn_funcs.Replace): |