mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-23 13:31:48 +01:00
- do_maintainer: introduced setBugownerHelper method
Do not swallow urllib2.HTTPError exceptions with code != 403
This commit is contained in:
parent
87fc39fee4
commit
38fbe8fb11
@ -7098,6 +7098,20 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
if verbose:
|
if verbose:
|
||||||
tags = ('login', 'realname', 'email')
|
tags = ('login', 'realname', 'email')
|
||||||
return get_user_data(apiurl, maintainer, *tags)
|
return get_user_data(apiurl, maintainer, *tags)
|
||||||
|
def setBugownerHelper(apiurl, project, package, bugowner):
|
||||||
|
try:
|
||||||
|
setBugowner(apiurl, project, package, bugowner)
|
||||||
|
except HTTPError as e:
|
||||||
|
if e.code != 403:
|
||||||
|
raise
|
||||||
|
print("No write permission in", project, end=' ')
|
||||||
|
if package:
|
||||||
|
print("/", package, end=' ')
|
||||||
|
print()
|
||||||
|
repl = raw_input('\nCreating a request instead? (y/n) ')
|
||||||
|
if repl.lower() == 'y':
|
||||||
|
opts.set_bugowner_request = bugowner
|
||||||
|
opts.set_bugowner = None
|
||||||
|
|
||||||
binary = None
|
binary = None
|
||||||
prj = None
|
prj = None
|
||||||
@ -7176,23 +7190,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
if searchresult:
|
if searchresult:
|
||||||
for result in searchresult.findall('owner'):
|
for result in searchresult.findall('owner'):
|
||||||
if opts.set_bugowner:
|
if opts.set_bugowner:
|
||||||
for role in roles:
|
setBugownerHelper(apiurl, result.get('project'), result.get('package'), opts.set_bugowner)
|
||||||
try:
|
|
||||||
setBugowner(apiurl, result.get('project'), result.get('package'), opts.set_bugowner)
|
|
||||||
except HTTPError as e:
|
|
||||||
if e.code == 403:
|
|
||||||
print("No write permission in", result.get('project'), end=' ')
|
|
||||||
if result.get('package'):
|
|
||||||
print("/", result.get('package'), end=' ')
|
|
||||||
print()
|
|
||||||
repl = raw_input('\nCreating a request instead? (y/n) ')
|
|
||||||
if repl.lower() == 'y':
|
|
||||||
opts.set_bugowner_request = opts.set_bugowner
|
|
||||||
opts.set_bugowner = None
|
|
||||||
break
|
|
||||||
|
|
||||||
if opts.set_bugowner_request:
|
if opts.set_bugowner_request:
|
||||||
for role in roles:
|
|
||||||
args = [bugowner, result.get('project')]
|
args = [bugowner, result.get('project')]
|
||||||
if result.get('package'):
|
if result.get('package'):
|
||||||
args = args + [result.get('package')]
|
args = args + [result.get('package')]
|
||||||
@ -7200,18 +7199,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
if opts.set_bugowner:
|
if opts.set_bugowner:
|
||||||
try:
|
setBugownerHelper(apiurl, prj, pac, opts.set_bugowner)
|
||||||
setBugowner(apiurl, prj, pac, opts.set_bugowner)
|
|
||||||
except HTTPError as e:
|
|
||||||
if e.code == 403:
|
|
||||||
print("No write permission in" + result.get('project'), end=' ')
|
|
||||||
if result.get('package'):
|
|
||||||
print("/", result.get('package'), end=' ')
|
|
||||||
print()
|
|
||||||
repl = raw_input('\nCreating a request instead? (y/n) ')
|
|
||||||
if repl.lower() == 'y':
|
|
||||||
opts.set_bugowner_request = opts.set_bugowner
|
|
||||||
opts.set_bugowner = None
|
|
||||||
|
|
||||||
if opts.set_bugowner_request:
|
if opts.set_bugowner_request:
|
||||||
args = [bugowner, prj]
|
args = [bugowner, prj]
|
||||||
|
Loading…
Reference in New Issue
Block a user