aboutsummaryrefslogtreecommitdiff
path: root/tests/docker/docker.py
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2019-07-12 14:50:52 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2019-08-22 17:30:25 +0400
commit2461d80e6c36dfefdcde1ec8735c317c31895c6b (patch)
tree6dc71a0de72aeb136808d3e653269f173d2c17ea /tests/docker/docker.py
parent810923480863c43ecb22ae124156298385439339 (diff)
docker.py: add --run-as-current-user
(podman will need further tweaks) Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'tests/docker/docker.py')
-rwxr-xr-xtests/docker/docker.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index 53a8c9c801..f15545aeea 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -333,8 +333,13 @@ class RunCommand(SubCommand):
def args(self, parser):
parser.add_argument("--keep", action="store_true",
help="Don't remove image when command completes")
+ parser.add_argument("--run-as-current-user", action="store_true",
+ help="Run container using the current user's uid")
def run(self, args, argv):
+ if args.run_as_current_user:
+ uid = os.getuid()
+ argv = [ "-u", str(uid) ] + argv
return Docker().run(argv, args.keep, quiet=args.quiet)