From 75d2d10a8159f89b60a6366a326b5183cd33e926 Mon Sep 17 00:00:00 2001 From: Hongbin Lu Date: Fri, 10 Apr 2020 19:46:36 +0000 Subject: [PATCH] Handle entrypoint is None Change-Id: Ic6eb27cb018eec6d476fbbe17f29ac020ce83b71 Closes-Bug: #1872130 --- zunclient/osc/v1/containers.py | 8 ++++++-- zunclient/tests/unit/v1/test_containers_shell.py | 1 - zunclient/v1/containers_shell.py | 6 ++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/zunclient/osc/v1/containers.py b/zunclient/osc/v1/containers.py index 9b38b369..c33c51f5 100644 --- a/zunclient/osc/v1/containers.py +++ b/zunclient/osc/v1/containers.py @@ -243,7 +243,9 @@ class CreateContainer(command.ShowOne): opts['command'] = parsed_args.command opts['registry'] = parsed_args.registry opts['host'] = parsed_args.host - opts['entrypoint'] = zun_utils.parse_entrypoint(parsed_args.entrypoint) + if parsed_args.entrypoint: + opts['entrypoint'] = zun_utils.parse_entrypoint( + parsed_args.entrypoint) if parsed_args.security_group: opts['security_groups'] = parsed_args.security_group if parsed_args.expose_port: @@ -946,7 +948,9 @@ class RunContainer(command.ShowOne): opts['command'] = parsed_args.command opts['registry'] = parsed_args.registry opts['host'] = parsed_args.host - opts['entrypoint'] = zun_utils.parse_entrypoint(parsed_args.entrypoint) + if parsed_args.entrypoint: + opts['entrypoint'] = zun_utils.parse_entrypoint( + parsed_args.entrypoint) if parsed_args.security_group: opts['security_groups'] = parsed_args.security_group if parsed_args.expose_port: diff --git a/zunclient/tests/unit/v1/test_containers_shell.py b/zunclient/tests/unit/v1/test_containers_shell.py index 205522df..c35274b7 100644 --- a/zunclient/tests/unit/v1/test_containers_shell.py +++ b/zunclient/tests/unit/v1/test_containers_shell.py @@ -28,7 +28,6 @@ def _get_container_args(**kwargs): 'mounts': [], 'nets': [], 'command': [], - 'entrypoint': [], } default_args.update(kwargs) return default_args diff --git a/zunclient/v1/containers_shell.py b/zunclient/v1/containers_shell.py index 72c09323..72f59680 100644 --- a/zunclient/v1/containers_shell.py +++ b/zunclient/v1/containers_shell.py @@ -215,7 +215,8 @@ def do_create(cs, args): opts['command'] = args.command opts['registry'] = args.registry opts['host'] = args.host - opts['entrypoint'] = zun_utils.parse_entrypoint(args.entrypoint) + if args.entrypoint: + opts['entrypoint'] = zun_utils.parse_entrypoint(args.entrypoint) if args.healthcheck: opts['healthcheck'] = zun_utils.parse_health(args.healthcheck) @@ -749,7 +750,8 @@ def do_run(cs, args): opts['command'] = args.command opts['registry'] = args.registry opts['host'] = args.host - opts['entrypoint'] = zun_utils.parse_entrypoint(args.entrypoint) + if args.entrypoint: + opts['entrypoint'] = zun_utils.parse_entrypoint(args.entrypoint) if args.healthcheck: opts['healthcheck'] = zun_utils.parse_health(args.healthcheck)