Merge "Split string commands on whitespace"

This commit is contained in:
Jenkins 2017-04-03 08:54:22 +00:00 committed by Gerrit Code Review
commit e8c10b6263
2 changed files with 13 additions and 5 deletions

View File

@ -88,7 +88,7 @@ def command_argument(cmd, command):
if not command:
return []
if not isinstance(command, list):
return [command]
return command.split()
return command

View File

@ -50,11 +50,12 @@ class HookDockerCmdTest(common.RunScriptTest):
"web": {
"name": "y",
"start_order": 1,
"image": "xxx",
"image": "yyy",
"net": "host",
"restart": "always",
"privileged": True,
"user": "root",
"command": "/bin/webserver start",
"volumes": [
"/run:/run",
"db:/var/lib/db"
@ -175,6 +176,7 @@ class HookDockerCmdTest(common.RunScriptTest):
'--env=foo=bar',
'--privileged=false',
'xxx'
''
], state[1]['args'])
self.assertEqual([
self.fake_tool_path,
@ -209,7 +211,9 @@ class HookDockerCmdTest(common.RunScriptTest):
'--user=root',
'--volume=/run:/run',
'--volume=db:/var/lib/db',
'xxx'
'yyy',
'/bin/webserver',
'start'
], state[3]['args'])
self.assertEqual([
self.fake_tool_path,
@ -366,7 +370,9 @@ class HookDockerCmdTest(common.RunScriptTest):
'--user=root',
'--volume=/run:/run',
'--volume=db:/var/lib/db',
'xxx'
'yyy',
'/bin/webserver',
'start'
], state[3]['args'])
self.assertEqual([
self.fake_tool_path,
@ -508,7 +514,9 @@ class HookDockerCmdTest(common.RunScriptTest):
'--user=root',
'--volume=/run:/run',
'--volume=db:/var/lib/db',
'xxx'
'yyy',
'/bin/webserver',
'start'
], state[5]['args'])
self.assertEqual([
self.fake_tool_path,