Commit 4a393379 authored by David Trudgian's avatar David Trudgian
Browse files

Fix pretty_json calls

parent e922c53c
......@@ -38,7 +38,7 @@ def post_layer(API_URI, image_name, image_uri, quiet):
if not quiet:
sys.stderr.write("Image registered as layer with Clair\n")
else:
raise ClairException("Failed registering image with Clair\n %s\n" % pretty_json(r))
raise ClairException("Failed registering image with Clair\n %s\n" % pretty_json(r.json()))
except Exception as e:
raise ClairException("Error - couldn't send image to Clair - %s\n" % (e))
......@@ -53,7 +53,7 @@ def get_report(API_URI, image_name):
if r.status_code == requests.codes.ok:
return r.json()
else:
raise ClairException("Failed retrieving report from Clair\n %s\n" % pretty_json(r))
raise ClairException("Failed retrieving report from Clair\n %s\n" % pretty_json(r.json()))
except Exception as e:
raise ClairException("Error - couldn't retrieve report from Clair - %s\n" % (e))
......
......@@ -14,7 +14,7 @@ def sha256(fname):
def pretty_json(obj):
"""Format an object into json nicely"""
return json.dumps(obj.json(), separators=(',', ':'), sort_keys=True, indent=2)
return json.dumps(obj, separators=(',', ':'), sort_keys=True, indent=2)
def err_and_exit(message, code=1):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment