diff options
author | JUN JIE NAN <nanjj@cn.ibm.com> | 2013-08-13 10:49:55 +0800 |
---|---|---|
committer | JUN JIE NAN <nanjj@cn.ibm.com> | 2013-08-13 10:49:55 +0800 |
commit | 5b83c132a325538c8eae283074d7bbf6e80fb5fe (patch) | |
tree | 91420251ad4064c5c0dbe72038377080b1e14598 | |
parent | 01705b8b33ce944276e85969e769fa293c8689e3 (diff) | |
download | heat-cfntools-5b83c132a325538c8eae283074d7bbf6e80fb5fe.tar.gz |
Pass cwd and env to test command
Promote get cwd before test command running and pass cwd to test
command.
Fixes bug #1211606
Change-Id: I2e4d3258f6d591d3d0aadffcefa36487c9122023
-rw-r--r-- | heat_cfntools/cfntools/cfn_helper.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/heat_cfntools/cfntools/cfn_helper.py b/heat_cfntools/cfntools/cfn_helper.py index 6f4b2c7..7ed2166 100644 --- a/heat_cfntools/cfntools/cfn_helper.py +++ b/heat_cfntools/cfntools/cfn_helper.py @@ -853,8 +853,16 @@ class CommandsHandler(object): cwd = None env = properties.get("env", None) + if "cwd" in properties: + cwd = os.path.expanduser(properties["cwd"]) + if not os.path.exists(cwd): + LOG.error("%s has failed. " % command_label + + "%s path does not exist" % cwd) + return + if "test" in properties: - test_status = CommandRunner(properties["test"]).run().status + test = CommandRunner(properties["test"]) + test_status = test.run('root', cwd, env).status if test_status != 0: LOG.info("%s test returns false, skipping command" % command_label) @@ -862,13 +870,6 @@ class CommandsHandler(object): else: LOG.debug("%s test returns true, proceeding" % command_label) - if "cwd" in properties: - cwd = os.path.expanduser(properties["cwd"]) - if not os.path.exists(cwd): - LOG.error("%s has failed. " % command_label + - "%s path does not exist" % cwd) - return - if "command" in properties: try: # TODO(pfreund) aws doc : "Either an array or a string |