1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-02-27 04:32:18 +01:00
Use the _signkey route for retrieving the signkey. Use the "old" way
as a fallback when talking with an old API. We should probably also
use this route in the fetch module.
This commit is contained in:
Marcus Huewe 2021-04-28 14:24:23 +02:00
commit 836412c57a

View File

@ -9013,21 +9013,30 @@ 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:
while True: try:
try: # use current api, supporting fallback to higher project and server side scripts
url = makeurl(apiurl, ['source', prj, '_pubkey']) query = {}
if opts.sslcert: if opts.sslcert:
url = makeurl(apiurl, ['source', prj, '_project', '_sslcert'], 'meta=1') query['withsslcert'] = 1
f = http_GET(url) url = makeurl(apiurl, ['source', prj, '_keyinfo'], query)
break f = http_GET(url)
except HTTPError as e: except HTTPError as e:
l = prj.rsplit(':', 1) # old way to do it
# try key from parent project while True:
if not opts.notraverse and len(l) > 1 and l[0] and l[1] and e.code == 404: try:
print('%s has no key, trying %s' % (prj, l[0])) url = makeurl(apiurl, ['source', prj, '_pubkey'])
prj = l[0] if opts.sslcert:
else: url = makeurl(apiurl, ['source', prj, '_project', '_sslcert'], 'meta=1')
raise f = http_GET(url)
break
except HTTPError as e:
l = prj.rsplit(':', 1)
# try key from parent project
if not opts.notraverse and len(l) > 1 and l[0] and l[1] and e.code == 404:
print('%s has no key, trying %s' % (prj, l[0]))
prj = l[0]
else:
raise
while True: while True:
buf = f.read(16384) buf = f.read(16384)