Commit ee53df63 authored by BAIRE Anthony's avatar BAIRE Anthony
Browse files

make error messages compatible with the registry api

parent 2bf5a74d
...@@ -51,14 +51,16 @@ def pre_pushpull(request, action): ...@@ -51,14 +51,16 @@ def pre_pushpull(request, action):
# find the relevant webapp # find the relevant webapp
webapp = Webapp.objects.get(docker_name=repo) webapp = Webapp.objects.get(docker_name=repo)
except Webapp.DoesNotExist: except Webapp.DoesNotExist:
return JsonResponse({"error": "unknown repository"}, status=404) return JsonResponse({"errors": [
{"code": "NAME_INVALID", "message": "unknown repository"}]}, status=404)
if action == "pull": if action == "pull":
# find the id of the WebappVersion to be pulled # find the id of the WebappVersion to be pulled
version = WebappVersion.objects.filter(webapp=webapp, number=tag, version = WebappVersion.objects.filter(webapp=webapp, number=tag,
state=WebappVersion.READY).order_by("-id").first() state=WebappVersion.READY).order_by("-id").first()
if version is None: if version is None:
return JsonResponse({"error": "unknown tag"}, status=404) return JsonResponse({"errors": [
{"code": "TAG_INVALID", "message": "unknown tag"}]}, status=404)
elif action == "push": elif action == "push":
# create a new WebappVersion entry in state USER # create a new WebappVersion entry in state USER
......
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