Merge "Ensure Functions can be created without stack definition"

This commit is contained in:
Zuul 2018-11-27 09:27:35 +00:00 committed by Gerrit Code Review
commit 3d6faf17b3
1 changed files with 9 additions and 2 deletions

View File

@ -62,9 +62,14 @@ class GetParam(function.Function):
def __init__(self, stack, fn_name, args):
super(GetParam, self).__init__(stack, fn_name, args)
self.parameters = self.stack.parameters
if self.stack is not None:
self.parameters = self.stack.parameters
else:
self.parameters = None
def result(self):
assert self.parameters is not None, "No stack definition in Function"
args = function.resolve(self.args)
if not args:
@ -542,9 +547,11 @@ class GetFile(function.Function):
def __init__(self, stack, fn_name, args):
super(GetFile, self).__init__(stack, fn_name, args)
self.files = self.stack.t.files
self.files = self.stack.t.files if self.stack is not None else None
def result(self):
assert self.files is not None, "No stack definition in Function"
args = function.resolve(self.args)
if not (isinstance(args, six.string_types)):
raise TypeError(_('Argument to "%s" must be a string') %