mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-10 14:56:14 +01:00
more convenience for osc signkey
This commit is contained in:
parent
75bdc2e6c7
commit
6fd0e98a73
@ -4220,10 +4220,13 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
help='create new gpg signing key for this project')
|
help='create new gpg signing key for this project')
|
||||||
@cmdln.option('--delete', action='store_true', default=False,
|
@cmdln.option('--delete', action='store_true', default=False,
|
||||||
help='delete the gpg signing key in this project')
|
help='delete the gpg signing key in this project')
|
||||||
|
@cmdln.option('--notraverse', action='store_true', default=False,
|
||||||
|
help='don\' traverse projects upwards to find key')
|
||||||
def do_signkey(self, subcmd, opts, *args):
|
def do_signkey(self, subcmd, opts, *args):
|
||||||
"""${cmd_name}: Manage Project Signing Key
|
"""${cmd_name}: Manage Project Signing Key
|
||||||
|
|
||||||
osc signkey [--create|--delete] <PROJECT>
|
osc signkey [--create|--delete] <PROJECT>
|
||||||
|
osc signkey [--notraverse] <PROJECT>
|
||||||
|
|
||||||
This command is for managing gpg keys. It shows the public key
|
This command is for managing gpg keys. It shows the public key
|
||||||
by default. There is no way to download or upload the private
|
by default. There is no way to download or upload the private
|
||||||
@ -4247,9 +4250,16 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
apiurl = conf.config['apiurl']
|
apiurl = conf.config['apiurl']
|
||||||
f = None
|
f = None
|
||||||
|
|
||||||
|
prj = None
|
||||||
|
if len(args) == 0:
|
||||||
|
dir = os.getcwd()
|
||||||
|
if is_project_dir(dir) or is_package_dir(dir):
|
||||||
|
prj = store_read_project(dir)
|
||||||
|
apiurl = store_read_apiurl(dir)
|
||||||
if len(args) == 1:
|
if len(args) == 1:
|
||||||
prj = args[0]
|
prj = args[0]
|
||||||
else:
|
|
||||||
|
if not prj:
|
||||||
raise oscerr.WrongArgs('Please specify just the project')
|
raise oscerr.WrongArgs('Please specify just the project')
|
||||||
|
|
||||||
if opts.create:
|
if opts.create:
|
||||||
@ -4259,8 +4269,20 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
url = makeurl(apiurl, ['source', prj, "_pubkey"])
|
url = makeurl(apiurl, ['source', prj, "_pubkey"])
|
||||||
f = http_DELETE(url)
|
f = http_DELETE(url)
|
||||||
else:
|
else:
|
||||||
url = makeurl(apiurl, ['source', prj, "_pubkey"])
|
prjs = [ prj ]
|
||||||
f = http_GET(url)
|
for prj in prjs:
|
||||||
|
try:
|
||||||
|
url = makeurl(apiurl, ['source', prj, "_pubkey"])
|
||||||
|
f = http_GET(url)
|
||||||
|
break
|
||||||
|
except Exception, e:
|
||||||
|
l = prj.rsplit(':', 1)
|
||||||
|
# try key from parent project
|
||||||
|
if not opts.notraverse and len(l) > 1 and l[1]:
|
||||||
|
print "%s has no key, trying %s" % (prj, l[0])
|
||||||
|
prjs.append(l[0])
|
||||||
|
else:
|
||||||
|
raise e
|
||||||
|
|
||||||
while 1:
|
while 1:
|
||||||
buf = f.read(16384)
|
buf = f.read(16384)
|
||||||
|
Loading…
Reference in New Issue
Block a user