From e37afbb65b77266f06dc96757bdbd404da8d173a Mon Sep 17 00:00:00 2001 From: Warren Usui Date: Thu, 18 Sep 2014 13:29:18 -0700 Subject: [PATCH] Handle list-json downburst failure. Use check_output instead of Popen and communicate() Fixes: #9519 Signed-off-by: Warren Usui --- teuthology/lock.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/teuthology/lock.py b/teuthology/lock.py index 83e1337a79..24f85627e9 100644 --- a/teuthology/lock.py +++ b/teuthology/lock.py @@ -51,12 +51,10 @@ def get_distro_from_downburst(): log.info('Using default values for supported os_type/os_version') return default_table try: - p = subprocess.Popen([executable_cmd, 'list-json'], - stdout=subprocess.PIPE, stderr=subprocess.PIPE,) - output, err = p.communicate() + output = subprocess.check_output([executable_cmd, 'list-json']) downburst_data = json.loads(output) return downburst_data - except OSError: + except (subprocess.CalledProcessError, OSError): log.info('Using default values for supported os_type/os_version') return default_table -- 2.39.5