Skip to content

Commit

Permalink
Avoid a potential http request if there are no services
Browse files Browse the repository at this point in the history
The vc_export_env call was introduced in commit
37ca553 ("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!
  • Loading branch information
marcus-h committed Feb 4, 2019
1 parent 37ca553 commit 555efc8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions osc/core.py
Expand Up @@ -406,6 +406,12 @@ def execute(self, dir, callmode = None, singleservice = None, verbose = None):
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())

Expand Down

0 comments on commit 555efc8

Please sign in to comment.