From ea8951309dd3290ef9070fe565676bf3dcd45ac1 Mon Sep 17 00:00:00 2001 From: Madhuri Kumari Date: Wed, 18 Oct 2017 22:14:38 +0530 Subject: [PATCH] Remove the runtime constraint This patch fixes the problem where the runtime had only choice "runc" and no other custom runtimes were not allowed. Now Zun supports running any custom runtime. Change-Id: I38efb4bee4aa7176ebfdcd3b5e817156a5f0f22d --- zunclient/osc/v1/containers.py | 6 ++---- zunclient/tests/unit/v1/test_containers_shell.py | 8 -------- zunclient/v1/containers_shell.py | 6 ++---- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/zunclient/osc/v1/containers.py b/zunclient/osc/v1/containers.py index f6bb73d7..43c73dc0 100644 --- a/zunclient/osc/v1/containers.py +++ b/zunclient/osc/v1/containers.py @@ -145,10 +145,9 @@ class CreateContainer(command.ShowOne): help='Automatically remove the container when it exits') parser.add_argument( '--runtime', - choices=['runc'], metavar='', help='The container runtime tool to create container with. ' - 'It can have following value: "runc"') + 'It can have value "runc" or any other custom runtime.') parser.add_argument( '--hostname', metavar='', @@ -689,9 +688,8 @@ class RunContainer(command.ShowOne): parser.add_argument( '--runtime', metavar='', - choices=['runc'], help='The container runtime tool to create container with. ' - 'It can have following value: "runc"') + 'It can have value "runc" or any other custom runtime.') parser.add_argument( '--hostname', metavar='', diff --git a/zunclient/tests/unit/v1/test_containers_shell.py b/zunclient/tests/unit/v1/test_containers_shell.py index d7714d3f..af8e6513 100644 --- a/zunclient/tests/unit/v1/test_containers_shell.py +++ b/zunclient/tests/unit/v1/test_containers_shell.py @@ -159,14 +159,6 @@ class ShellTest(shell_test_base.TestCommandLineArgument): self._test_arg_success('run --runtime runc x') mock_show_container.assert_called_once_with('container') - @mock.patch('zunclient.v1.containers.ContainerManager.run') - def test_zun_container_run_failure_with_wrong_runtime( - self, mock_run): - self._test_arg_failure( - 'run --runtime wrong x', - self._invalid_choice_error) - self.assertFalse(mock_run.called) - @mock.patch('zunclient.v1.containers_shell._show_container') @mock.patch('zunclient.v1.containers.ContainerManager.run') def test_zun_container_run_success_with_hostname( diff --git a/zunclient/v1/containers_shell.py b/zunclient/v1/containers_shell.py index db3f736b..25d42a55 100644 --- a/zunclient/v1/containers_shell.py +++ b/zunclient/v1/containers_shell.py @@ -114,9 +114,8 @@ def _show_container(container): 'v6-fixed-ip: IPv6 fixed address for container.') @utils.arg('--runtime', metavar='', - choices=['runc'], help='The container runtime tool to create container with. ' - 'It can have following value: "runc"') + 'It can have value "runc" or any other custom runtime.') @utils.arg('--hostname', metavar='', default=None, @@ -505,9 +504,8 @@ def do_kill(cs, args): 'v6-fixed-ip: IPv6 fixed address for container.') @utils.arg('--runtime', metavar='', - choices=['runc'], help='The container runtime tool to create container with. ' - 'It can have following value: "runc"') + 'It can have value "runc" or any other custom runtime.') @utils.arg('--hostname', metavar='', default=None,