From 1753883e58964cdc251d9958b40deba510764d7a Mon Sep 17 00:00:00 2001 From: Susant Sahani Date: Mar 08 2019 12:31:03 +0000 Subject: Docker provisiner: Use python3 interpreter Since we have already ported to python3 do not look for python2 interpreter --- diff --git a/inventory/standard-inventory-docker b/inventory/standard-inventory-docker index bc3371d..d33d804 100755 --- a/inventory/standard-inventory-docker +++ b/inventory/standard-inventory-docker @@ -112,25 +112,24 @@ def inv_host(subject, docker_extra_args): raise RuntimeError("Could not find container file for launched container") with open(cidfile, "r") as f: name = f.read().strip() - # Need to figure out what python interpreter to use - interpreters = ["/usr/bin/python3", "/usr/bin/python2"] - for interpreter in interpreters: - check_file = ["/usr/bin/docker", "exec", "--user=root", name, "/usr/bin/ls", interpreter] - try: - subprocess.check_call(check_file, stdout=null, stderr=null) - ansible_python_interpreter = interpreter - break - except subprocess.CalledProcessError: - pass + + # Figure out what whenther python3 interpreter is available + check_file = ["/usr/bin/docker", "exec", "--user=root", name, "/usr/bin/ls", "/usr/bin/python3"] + try: + subprocess.check_call(check_file, stdout=null, stderr=null) + break + except subprocess.CalledProcessError: + pass else: logger.error("Could not set ansible_python_interpreter.") return None + # Directory to place artifacts artifacts = os.environ.get("TEST_ARTIFACTS", os.path.join(os.getcwd(), "artifacts")) # The variables variables = { "ansible_connection": "docker", - "ansible_python_interpreter": ansible_python_interpreter + "ansible_python_interpreter": "/usr/bin/python3" } # Process of our parent ppid = os.getppid()