Skip to content

Commit

Permalink
Merge branch 'fix-single-service-run' of https://github.com/cmurphy/osc
Browse files Browse the repository at this point in the history
Fix "osc service run <service>" so that it takes the parameters from
the _service file if <service> is present in the _service file. Also
document (+ fix) the (undocumented) "osc service <command> <service>"
behavior. This enables, for instance, to run "osc service mr foobar",
which would execute all foobar services with mode "manual" (now, this
also works, if the foobar service is not part of the _service file).
  • Loading branch information
marcus-h committed Aug 4, 2020
2 parents 7612fe1 + cb6eaf3 commit 3216a56
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
10 changes: 6 additions & 4 deletions osc/commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -6938,18 +6938,20 @@ def do_service(self, subcmd, opts, *args):
osc service COMMAND (inside working copy)
osc service run [SOURCE_SERVICE]
osc service runall
osc service localrun
osc service disabledrun
osc service manualrun [SOURCE_SERVICE]
osc service localrun [SOURCE_SERVICE]
osc service disabledrun [SOURCE_SERVICE]
osc service remoterun [PROJECT PACKAGE]
osc service merge [PROJECT PACKAGE]
osc service wait [PROJECT PACKAGE]
COMMAND can be:
run r run defined services locally, it takes an optional parameter to run only a
run r run defined services with modes "trylocal", "localonly", or no mode set locally, may take an optional parameter to run only a
specified source service. In case parameters exist for this one in _service file
they are used.
runall ra run all services independent of the used mode
manualrun mr run all services with mode "manual"
manualrun mr run all services with mode "manual", may take an optional parameter to run only a
specified source service
remoterun rr trigger a re-run on the server side
merge commits all server side generated files and drops the _service definition
wait waits until the service finishes and returns with an error if it failed
Expand Down
9 changes: 5 additions & 4 deletions osc/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,10 +422,13 @@ def execute(self, dir, callmode = None, singleservice = None, verbose = None):
os.unlink(ent)

allservices = self.services or []
if singleservice and not singleservice in allservices:
service_names = [s['name'] for s in allservices]
if singleservice and singleservice not in service_names:
# set array to the manual specified singleservice, if it is not part of _service file
data = { 'name' : singleservice, 'command' : [ singleservice ], 'mode' : '' }
data = { 'name' : singleservice, 'command' : [ singleservice ], 'mode' : callmode }
allservices = [data]
elif singleservice:
allservices = [s for s in allservices if s['name'] == singleservice]

if not allservices:
# short-circuit to avoid a potential http request in vc_export_env
Expand All @@ -449,8 +452,6 @@ def execute(self, dir, callmode = None, singleservice = None, verbose = None):
ret = 0
for service in allservices:
if callmode != "all":
if singleservice and service['name'] != singleservice:
continue
if service['mode'] == "buildtime":
continue
if service['mode'] == "serveronly" and callmode != "local":
Expand Down

0 comments on commit 3216a56

Please sign in to comment.