Add error IDs for when an unknown commit is requested.
(cherry picked from commit 07528a431e
)
This commit is contained in:
parent
2f8f076b1f
commit
785ee7bcc3
@ -32,5 +32,8 @@ INVALID_NAME = "InvalidName"
|
|||||||
# Returned from the API when a blueprint that was requested does not exist.
|
# Returned from the API when a blueprint that was requested does not exist.
|
||||||
UNKNOWN_BLUEPRINT = "UnknownBlueprint"
|
UNKNOWN_BLUEPRINT = "UnknownBlueprint"
|
||||||
|
|
||||||
|
# Returned from the API when a commit that was requested does not exist.
|
||||||
|
UNKNOWN_COMMIT = "UnknownCommit"
|
||||||
|
|
||||||
# Returned from the API when a UUID that was requested does not exist.
|
# Returned from the API when a UUID that was requested does not exist.
|
||||||
UNKNOWN_UUID = "UnknownUUID"
|
UNKNOWN_UUID = "UnknownUUID"
|
||||||
|
@ -1269,7 +1269,7 @@ def v0_api(api):
|
|||||||
workspace_write(api.config["GITLOCK"].repo, branch, blueprint)
|
workspace_write(api.config["GITLOCK"].repo, branch, blueprint)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.error("(v0_blueprints_undo) %s", str(e))
|
log.error("(v0_blueprints_undo) %s", str(e))
|
||||||
return jsonify(status=False, errors=[str(e)]), 400
|
return jsonify(status=False, errors=[{"id": UNKNOWN_COMMIT, "msg": str(e)}]), 400
|
||||||
else:
|
else:
|
||||||
return jsonify(status=True)
|
return jsonify(status=True)
|
||||||
|
|
||||||
@ -1322,7 +1322,7 @@ def v0_api(api):
|
|||||||
old_blueprint = read_recipe_commit(api.config["GITLOCK"].repo, branch, blueprint_name, from_commit)
|
old_blueprint = read_recipe_commit(api.config["GITLOCK"].repo, branch, blueprint_name, from_commit)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.error("(v0_blueprints_diff) %s", str(e))
|
log.error("(v0_blueprints_diff) %s", str(e))
|
||||||
return jsonify(status=False, errors=[str(e)]), 400
|
return jsonify(status=False, errors=[{"id": UNKNOWN_COMMIT, "msg": str(e)}]), 400
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if to_commit == "WORKSPACE":
|
if to_commit == "WORKSPACE":
|
||||||
@ -1340,7 +1340,7 @@ def v0_api(api):
|
|||||||
new_blueprint = read_recipe_commit(api.config["GITLOCK"].repo, branch, blueprint_name, to_commit)
|
new_blueprint = read_recipe_commit(api.config["GITLOCK"].repo, branch, blueprint_name, to_commit)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.error("(v0_blueprints_diff) %s", str(e))
|
log.error("(v0_blueprints_diff) %s", str(e))
|
||||||
return jsonify(status=False, errors=[str(e)]), 400
|
return jsonify(status=False, errors=[{"id": UNKNOWN_COMMIT, "msg": str(e)}]), 400
|
||||||
|
|
||||||
diff = recipe_diff(old_blueprint, new_blueprint)
|
diff = recipe_diff(old_blueprint, new_blueprint)
|
||||||
return jsonify(diff=diff)
|
return jsonify(diff=diff)
|
||||||
|
Loading…
Reference in New Issue
Block a user