encrypt_secret: display the full_url on error
When the project or tenant is misspelled, an exception is raised with little informations. This change adds an error message to print the used url. Change-Id: Ifba7b02204894b41b6d4573c0ac1d40e17bd09b8
This commit is contained in:
parent
dd954db3cc
commit
0eb80dd3f4
|
@ -105,7 +105,12 @@ def main():
|
||||||
else:
|
else:
|
||||||
req = Request("%s/api/tenant/%s/key/%s.pub" % (
|
req = Request("%s/api/tenant/%s/key/%s.pub" % (
|
||||||
args.url.rstrip('/'), args.tenant, args.project))
|
args.url.rstrip('/'), args.tenant, args.project))
|
||||||
pubkey = urlopen(req, context=ssl_ctx)
|
try:
|
||||||
|
pubkey = urlopen(req, context=ssl_ctx)
|
||||||
|
except Exception:
|
||||||
|
sys.stderr.write(
|
||||||
|
"ERROR: Couldn't retrieve project key via %s\n" % req.full_url)
|
||||||
|
raise
|
||||||
|
|
||||||
if args.infile:
|
if args.infile:
|
||||||
with open(args.infile) as f:
|
with open(args.infile) as f:
|
||||||
|
|
Loading…
Reference in New Issue