[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 1/6] docker: add "probe" command for configure
From: |
Alex Bennée |
Subject: |
[Qemu-devel] [PULL 1/6] docker: add "probe" command for configure |
Date: |
Tue, 5 Jun 2018 17:05:36 +0100 |
This is a helper function for the configure script. It replies yes,
sudo or no to inform the user if non-interactive docker support is
available. We trap the Exception to fail gracefully.
Signed-off-by: Alex Bennée <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>
diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index 1246ba9578..f8267586eb 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -390,6 +390,24 @@ class ImagesCommand(SubCommand):
def run(self, args, argv):
return Docker().command("images", argv, args.quiet)
+
+class ProbeCommand(SubCommand):
+ """Probe if we can run docker automatically"""
+ name = "probe"
+
+ def run(self, args, argv):
+ try:
+ docker = Docker()
+ if docker._command[0] == "docker":
+ print "yes"
+ elif docker._command[0] == "sudo":
+ print "sudo"
+ except Exception:
+ print "no"
+
+ return
+
+
def main():
parser = argparse.ArgumentParser(description="A Docker helper",
usage="%s <subcommand> ..." % os.path.basename(sys.argv[0]))
--
2.17.0
- [Qemu-devel] [PULL 0/6] Some docker updates, Alex Bennée, 2018/06/05
- [Qemu-devel] [PULL 5/6] docker: test-mingw: use SDL2 and GTK+3, Alex Bennée, 2018/06/05
- [Qemu-devel] [PULL 4/6] docker: Add fedora-i386-cross image, Alex Bennée, 2018/06/05
- [Qemu-devel] [PULL 2/6] configure: add test for docker availability, Alex Bennée, 2018/06/05
- [Qemu-devel] [PULL 1/6] docker: add "probe" command for configure,
Alex Bennée <=
- [Qemu-devel] [PULL 6/6] docker: add debian/tricore image, Alex Bennée, 2018/06/05
- [Qemu-devel] [PULL 3/6] Makefile: Rename TARGET_DIRS to TARGET_LIST, Alex Bennée, 2018/06/05
- Re: [Qemu-devel] [PULL 0/6] Some docker updates, Peter Maydell, 2018/06/07