qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Marc-André Lureau" <marcandre.lureau@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Fam Zheng" <fam@euphon.net>,
	peter.maydell@linaro.org,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	alex.bennee@linaro.org,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [Qemu-devel] [PULL 1/6] docker.py: add --run-as-current-user
Date: Thu, 22 Aug 2019 17:47:20 +0400	[thread overview]
Message-ID: <20190822134725.32479-2-marcandre.lureau@redhat.com> (raw)
In-Reply-To: <20190822134725.32479-1-marcandre.lureau@redhat.com>

(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>
---
 tests/docker/Makefile.include | 2 +-
 tests/docker/docker.py        | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
index dbd58e548c..582846a587 100644
--- a/tests/docker/Makefile.include
+++ b/tests/docker/Makefile.include
@@ -212,7 +212,7 @@ docker-run: docker-qemu-src
 			"  COPYING $(EXECUTABLE) to $(IMAGE)"))
 	$(call quiet-command,						\
 		$(DOCKER_SCRIPT) run 					\
-			$(if $(NOUSER),,-u $(shell id -u)) 		\
+			$(if $(NOUSER),,--run-as-current-user) 		\
 			--security-opt seccomp=unconfined		\
 			$(if $V,,--rm) 					\
 			$(if $(DEBUG),-ti,)				\
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)
 
 
-- 
2.23.0



  reply	other threads:[~2019-08-22 13:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-22 13:47 [Qemu-devel] [PULL 0/6] Podman patches Marc-André Lureau
2019-08-22 13:47 ` Marc-André Lureau [this message]
2019-08-22 13:47 ` [Qemu-devel] [PULL 2/6] docker.py: add podman support Marc-André Lureau
2019-09-03 13:41   ` Philippe Mathieu-Daudé
2019-09-03 14:02     ` Alex Bennée
2019-08-22 13:47 ` [Qemu-devel] [PULL 3/6] tests/docker: " Marc-André Lureau
2019-08-22 13:47 ` [Qemu-devel] [PULL 4/6] tests: specify the address family when checking bind Marc-André Lureau
2019-08-22 13:47 ` [Qemu-devel] [PULL 5/6] test-char: skip tcp tests if ipv4 check failed Marc-André Lureau
2019-08-22 13:47 ` [Qemu-devel] [PULL 6/6] test: skip tests if socket_check_protocol_support() failed Marc-André Lureau
2019-08-23 14:15 ` [Qemu-devel] [PULL 0/6] Podman patches Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190822134725.32479-2-marcandre.lureau@redhat.com \
    --to=marcandre.lureau@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=fam@euphon.net \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).