From 933040425c380dc81f0d6ca786048b96e06c21ae Mon Sep 17 00:00:00 2001 From: Daniel Mach Date: Mon, 15 Jan 2024 09:59:28 +0100 Subject: [PATCH] The 'token --trigger' command no longer sets '--operation=runservice' by default. The operation is bound to the token on the server. We no longer have to specify it during trigger. If we still specify it, the only benefit is double-checking the operation that is set on the client and verified on the server. --- osc/commandline.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/osc/commandline.py b/osc/commandline.py index 7ef47be4..9178bcf1 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -1659,7 +1659,7 @@ class Osc(cmdln.Cmdln): @cmdln.option('-d', '--delete', metavar='TOKENID', help='Delete a token') @cmdln.option('-o', '--operation', metavar='OPERATION', - help='Default is "runservice", but "branch", "release", "rebuild", or "workflow" can also be used') + help="Operation associated with the token. Choices: runservice, branch, release, rebuild, workflow") @cmdln.option('-t', '--trigger', metavar='TOKENSTRING', help='Trigger the action of a token') @cmdln.option('', '--scm-token', metavar='SCM_TOKEN', @@ -1718,12 +1718,14 @@ class Osc(cmdln.Cmdln): http_DELETE(url) elif opts.trigger: print("Trigger token") - operation = opts.operation or "runservice" query = {} if len(args) > 1: query['project'] = args[0] query['package'] = args[1] - url = makeurl(apiurl, ['trigger', operation], query) + if opts.operation: + url = makeurl(apiurl, ["trigger", opts.operation], query) + else: + url = makeurl(apiurl, ["trigger"], query) headers = { 'Content-Type': 'application/octet-stream', 'Authorization': "Token " + opts.trigger,