mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-28 18:56:15 +01:00
Merge pull request #512 from adrianschroeter/triggers
support different token operations (runservice, release and rebuild) …
This commit is contained in:
commit
497cb3af60
4
NEWS
4
NEWS
@ -1,5 +1,5 @@
|
||||
0.165.2
|
||||
-
|
||||
0.166
|
||||
- support different token operations (runservice, release and rebuild) (requires OBS 2.10)
|
||||
|
||||
0.165.1
|
||||
- fix oscssl "urldefrag is not defined error"
|
||||
|
@ -728,6 +728,8 @@ class Osc(cmdln.Cmdln):
|
||||
help='Create a new token')
|
||||
@cmdln.option('-d', '--delete', metavar='TOKENID',
|
||||
help='Delete a token')
|
||||
@cmdln.option('-o', '--operation', metavar='OPERATION',
|
||||
help='Default is "runservice", but "release" or "rebuild" can also be used')
|
||||
@cmdln.option('-t', '--trigger', metavar='TOKENSTRING',
|
||||
help='Trigger the action of a token')
|
||||
def do_token(self, subcmd, opts, *args):
|
||||
@ -738,9 +740,9 @@ class Osc(cmdln.Cmdln):
|
||||
|
||||
Usage:
|
||||
osc token
|
||||
osc token --create [<PROJECT> <PACKAGE>]
|
||||
osc token --create [--operation <OPERATION>] [<PROJECT> <PACKAGE>]
|
||||
osc token --delete <TOKENID>
|
||||
osc token --trigger <TOKENSTRING>
|
||||
osc token --trigger <TOKENSTRING> [--operation <OPERATION>] [<PROJECT> <PACKAGE>]
|
||||
${cmd_option_list}
|
||||
"""
|
||||
|
||||
@ -752,6 +754,8 @@ class Osc(cmdln.Cmdln):
|
||||
if opts.create:
|
||||
print("Create a new token")
|
||||
url += "?cmd=create"
|
||||
if opts.operation:
|
||||
url += "&operation=" + opts.operation
|
||||
if len(args) > 1:
|
||||
url += "&project=" + args[0]
|
||||
url += "&package=" + args[1]
|
||||
@ -769,7 +773,11 @@ class Osc(cmdln.Cmdln):
|
||||
http_DELETE(url)
|
||||
elif opts.trigger:
|
||||
print("Trigger token")
|
||||
url = apiurl + "/trigger/runservice"
|
||||
operation = opts.operation or "runservice"
|
||||
url = apiurl + "/trigger/" + operation
|
||||
if len(args) > 1:
|
||||
url += "?project=" + args[0]
|
||||
url += "&package=" + args[1]
|
||||
req = URLRequest(url)
|
||||
req.get_method = lambda: "POST"
|
||||
req.add_header('Content-Type', 'application/octet-stream')
|
||||
|
Loading…
Reference in New Issue
Block a user