From 555efc845f0c11564bc087864acbcbfd37be13e1 Mon Sep 17 00:00:00 2001 From: Marcus Huewe Date: Mon, 4 Feb 2019 12:16:54 +0100 Subject: [PATCH] Avoid a potential http request if there are no services The vc_export_env call was introduced in commit 37ca5535ce6a3992f0b649dddd6972b7be07d3b6 ("Export vc env vars when running a source service") and broke the testsuite. The potential http request is useless if there are no services. Hence, avoid it. Thanks to Marco Strigl for catching the testsuite error! --- osc/core.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osc/core.py b/osc/core.py index 54ed3b87..6c193322 100644 --- a/osc/core.py +++ b/osc/core.py @@ -406,6 +406,12 @@ class Serviceinfo: data = { 'name' : singleservice, 'command' : [ singleservice ], 'mode' : '' } allservices = [data] + if not allservices: + # short-circuit to avoid a potential http request in vc_export_env + # (if there are no services to execute this http request is + # useless) + return 0 + # services can detect that they run via osc this way os.putenv("OSC_VERSION", get_osc_version())