Kaydet (Commit) edebf375 authored tarafından Colin Huang's avatar Colin Huang

Split the entrypoint string to shell-like syntax.

üst 9bb6a6fd
...@@ -564,6 +564,9 @@ def create_container_config( ...@@ -564,6 +564,9 @@ def create_container_config(
if isinstance(command, six.string_types): if isinstance(command, six.string_types):
command = shlex.split(str(command)) command = shlex.split(str(command))
if isinstance(entrypoint, six.string_types):
entrypoint = shlex.split(str(entrypoint))
if isinstance(environment, dict): if isinstance(environment, dict):
environment = [ environment = [
six.text_type('{0}={1}').format(k, v) six.text_type('{0}={1}').format(k, v)
......
...@@ -428,7 +428,7 @@ class DockerClientTest(Cleanup, base.BaseTestCase): ...@@ -428,7 +428,7 @@ class DockerClientTest(Cleanup, base.BaseTestCase):
def test_create_container_with_entrypoint(self): def test_create_container_with_entrypoint(self):
try: try:
self.client.create_container('busybox', 'hello', self.client.create_container('busybox', 'hello',
entrypoint='cowsay') entrypoint='cowsay entry')
except Exception as e: except Exception as e:
self.fail('Command should not raise exception: {0}'.format(e)) self.fail('Command should not raise exception: {0}'.format(e))
...@@ -443,7 +443,7 @@ class DockerClientTest(Cleanup, base.BaseTestCase): ...@@ -443,7 +443,7 @@ class DockerClientTest(Cleanup, base.BaseTestCase):
"AttachStdout": true, "OpenStdin": false, "AttachStdout": true, "OpenStdin": false,
"StdinOnce": false, "StdinOnce": false,
"NetworkDisabled": false, "NetworkDisabled": false,
"Entrypoint": "cowsay"}''')) "Entrypoint": ["cowsay", "entry"]}'''))
self.assertEqual(args[1]['headers'], self.assertEqual(args[1]['headers'],
{'Content-Type': 'application/json'}) {'Content-Type': 'application/json'})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment