From bf0fb911fded085009a5bd21922b2238b894dc18 Mon Sep 17 00:00:00 2001 From: ldericher Date: Mon, 24 Aug 2020 14:49:17 +0200 Subject: [PATCH] shell -u argument --- src/kiwi/subcommands/shell.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/kiwi/subcommands/shell.py b/src/kiwi/subcommands/shell.py index 0a240de..6ae4a0f 100644 --- a/src/kiwi/subcommands/shell.py +++ b/src/kiwi/subcommands/shell.py @@ -84,13 +84,21 @@ class ShellCommand(ServiceCommand): help="shell to spawn" ) + # -u argument: Run as user + self._sub_parser.add_argument( + '-u', '--user', type=str, + help="container user to run shell" + ) + def _run_services(self, runner, args, project, services): service = services[0] shell = _find_shell(args, project, service) + user_args = ['-u', args.user] if args.user else [] + if shell is not None: # spawn shell - project.compose_run(['exec', service, shell]) + project.compose_run(['exec', *user_args, service, shell]) return True return False