From 5d202ec66f263f61f7dbd9d75a54d5b6fe14f48b Mon Sep 17 00:00:00 2001 From: yxf Date: Fri, 6 Feb 2026 10:12:56 +0800 Subject: [PATCH] fix: improve run_as_user and run_as_group handling --- gpustack_runtime/deployer/docker.py | 12 ++++++++++-- gpustack_runtime/deployer/podman.py | 12 ++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/gpustack_runtime/deployer/docker.py b/gpustack_runtime/deployer/docker.py index 56b51e8..2e0c652 100644 --- a/gpustack_runtime/deployer/docker.py +++ b/gpustack_runtime/deployer/docker.py @@ -910,8 +910,16 @@ def _create_containers( create_options["working_dir"] = c.execution.working_dir create_options["entrypoint"] = c.execution.command create_options["command"] = c.execution.args - run_as_user = c.execution.run_as_user or workload.run_as_user - run_as_group = c.execution.run_as_group or workload.run_as_group + run_as_user = ( + c.execution.run_as_user + if c.execution.run_as_user is not None + else workload.run_as_user + ) + run_as_group = ( + c.execution.run_as_group + if c.execution.run_as_group is not None + else workload.run_as_group + ) if run_as_user is not None: create_options["user"] = run_as_user if run_as_group is not None: diff --git a/gpustack_runtime/deployer/podman.py b/gpustack_runtime/deployer/podman.py index 075d234..12eeb75 100644 --- a/gpustack_runtime/deployer/podman.py +++ b/gpustack_runtime/deployer/podman.py @@ -911,8 +911,16 @@ def _create_containers( create_options["working_dir"] = c.execution.working_dir create_options["entrypoint"] = c.execution.command create_options["command"] = c.execution.args - run_as_user = c.execution.run_as_user or workload.run_as_user - run_as_group = c.execution.run_as_group or workload.run_as_group + run_as_user = ( + c.execution.run_as_user + if c.execution.run_as_user is not None + else workload.run_as_user + ) + run_as_group = ( + c.execution.run_as_group + if c.execution.run_as_group is not None + else workload.run_as_group + ) if run_as_user is not None: create_options["user"] = run_as_user if run_as_group is not None: