Replace while with if in resolve function

Functions can't return functions, so we don't need to use `while`.
This doesn't change behaviour of code, just makes it more understandable
and convenient.

Change-Id: Ia1dac5a9583cb99db23a8838412e5bc02e93ef4c
This commit is contained in:
Oleksii Chuprykov 2016-06-24 14:46:40 +03:00
parent 7ea3e68eb9
commit ee4515ed2c
2 changed files with 4 additions and 4 deletions

View File

@ -127,8 +127,8 @@ class Function(object):
def resolve(snippet):
while isinstance(snippet, Function):
snippet = snippet.result()
if isinstance(snippet, Function):
return snippet.result()
if isinstance(snippet, collections.Mapping):
return dict((k, resolve(v)) for k, v in snippet.items())

View File

@ -462,9 +462,9 @@ class ResourceGroup(stack_resource.StackResource):
# assigned. Pass in a custom resolver to the properties to not
# error when a parameter does not have a user entered value.
def ignore_param_resolve(snippet):
while isinstance(snippet, function.Function):
if isinstance(snippet, function.Function):
try:
snippet = snippet.result()
return snippet.result()
except exception.UserParameterMissing:
return None