Support array values in command
Description of command in CFN User Guide: Either an array or a string specifying the command to run. If you use an array, you do not need to escape space characters or enclose command parameters in quotes. So we escape double quote first, and enclose each array value in double quote. Fixes bug #1211605 Change-Id: I28ecdb0d4b8a12690dddeac4e2398264c6d6f212
This commit is contained in:
parent
5b83c132a3
commit
2044ef239d
@ -872,9 +872,11 @@ class CommandsHandler(object):
|
||||
|
||||
if "command" in properties:
|
||||
try:
|
||||
# TODO(pfreund) aws doc : "Either an array or a string
|
||||
# specifying the command to run" Need the array.
|
||||
command = CommandRunner(properties["command"])
|
||||
command = properties["command"]
|
||||
if isinstance(command, list):
|
||||
escape = lambda x: '"%s"' % x.replace('"', '\\"')
|
||||
command = ' '.join(map(escape, command))
|
||||
command = CommandRunner(command)
|
||||
command.run('root', cwd, env)
|
||||
command_status = command.status
|
||||
except OSError as e:
|
||||
|
Loading…
x
Reference in New Issue
Block a user