Skip to content

Commit

Permalink
Merge pull request #711 from jberry-suse/unlock
Browse files Browse the repository at this point in the history
osc-staging: provide unlock to resolve stuck staging locks.
  • Loading branch information
lnussel committed Mar 8, 2017
2 parents 9acbc46 + 9c55799 commit 784c567
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion osc-staging.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ def do_staging(self, subcmd, opts, *args):
"unselect" will remove from the project - pushing them back to the backlog
"unlock" will remove the staging lock in case it gets stuck
Usage:
osc staging accept [--force] [--no-cleanup] [LETTER...]
osc staging acheck
Expand All @@ -213,6 +215,7 @@ def do_staging(self, subcmd, opts, *args):
osc staging select [--no-freeze] [--move [--from PROJECT] STAGING REQUEST...
osc staging select [--no-freeze] [[--interactive] [--filter-by...] [--group-by...]] [STAGING...] [REQUEST...]
osc staging unselect REQUEST...
osc staging unlock
osc staging repair REQUEST...
"""
if opts.version:
Expand Down Expand Up @@ -240,6 +243,8 @@ def do_staging(self, subcmd, opts, *args):
min_args, max_args = 0, None
elif cmd in ('cleanup_rings', 'acheck'):
min_args, max_args = 0, 0
elif cmd == 'unlock':
min_args, max_args = 0, 0
else:
raise oscerr.WrongArgs('Unknown command: %s' % cmd)
if len(args) - 1 < min_args:
Expand All @@ -256,7 +261,12 @@ def do_staging(self, subcmd, opts, *args):
if opts.wipe_cache:
Cache.delete_all()

with OBSLock(opts.apiurl, opts.project):
lock = OBSLock(opts.apiurl, opts.project)
if cmd == 'unlock':
lock.release()
return

with lock:
api = StagingAPI(opts.apiurl, opts.project)

# call the respective command and parse args by need
Expand Down

0 comments on commit 784c567

Please sign in to comment.