1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-12 08:56:13 +01:00

- give a better hint to the user, when a search role is not defined

This commit is contained in:
Adrian Schröter 2014-07-10 09:50:52 +02:00
parent d86e28744f
commit f8a1fa2ebc

View File

@ -7128,7 +7128,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
roles = [ 'bugowner', 'maintainer' ] roles = [ 'bugowner', 'maintainer' ]
if len(opts.role): if len(opts.role):
roles = opts.role roles = opts.role
if opts.bugowner_only or opts.bugowner or subcmd == 'bugowner': elif opts.bugowner_only or opts.bugowner or subcmd == 'bugowner':
roles = [ 'bugowner' ] roles = [ 'bugowner' ]
args = slash_split(args) args = slash_split(args)
@ -7163,19 +7163,24 @@ Please submit there instead, or use --nodevelproject to force direct submission.
filterroles = None filterroles = None
if binary: if binary:
searchresult = owner(apiurl, binary, "binary", usefilter=filterroles, devel=None, limit=limit) searchresult = owner(apiurl, binary, "binary", usefilter=filterroles, devel=None, limit=limit)
if not searchresult and (opts.set_bugowner or opts.set_bugowner_request): if searchresult != None and len(searchresult) == 0:
# filtered search did not succeed, but maybe we want to set an owner initially? # We talk to an OBS 2.4 or later understanding the call
searchresult = owner(apiurl, binary, "binary", usefilter="", devel=None, limit=-1) if opts.set_bugowner or opts.set_bugowner_request:
if searchresult: # filtered search did not succeed, but maybe we want to set an owner initially?
print("WARNING: the binary exists, but has no matching maintainership roles defined.") searchresult = owner(apiurl, binary, "binary", usefilter="", devel=None, limit=-1)
print("Do you want to set it in the container where the binary appeared first?") if searchresult:
result = searchresult.find('owner') print("WARNING: the binary exists, but has no matching maintainership roles defined.")
print("This is: " + result.get('project'), end=' ') print("Do you want to set it in the container where the binary appeared first?")
if result.get('package'): result = searchresult.find('owner')
print (" / " + result.get('package')) print("This is: " + result.get('project'), end=' ')
repl = raw_input('\nUse this container? (y/n) ') if result.get('package'):
if repl.lower() != 'y': print (" / " + result.get('package'))
searchresult = None repl = raw_input('\nUse this container? (y/n) ')
if repl.lower() != 'y':
searchresult = None
else:
print("Empty search result, you may want to search with other or all roles via -r ''")
return
elif opts.user: elif opts.user:
searchresult = owner(apiurl, opts.user, "user", usefilter=filterroles, devel=None) searchresult = owner(apiurl, opts.user, "user", usefilter=filterroles, devel=None)
elif opts.group: elif opts.group: