Change INVALID_NAME to INVALID_CHARS.
It's getting used in a whole lot more places now, so make it a bit more generic sounding.
This commit is contained in:
parent
bc96f75992
commit
bf0318eab6
@ -42,9 +42,9 @@ BUILD_MISSING_FILE = "BuildMissingFile"
|
|||||||
# Returned from the API for all other errors from a /compose/* route.
|
# Returned from the API for all other errors from a /compose/* route.
|
||||||
COMPOSE_ERROR = "ComposeError"
|
COMPOSE_ERROR = "ComposeError"
|
||||||
|
|
||||||
# Returned from the API when a blueprint name or other similar identifier is
|
# Returned from the API when invalid characters are used in a route path or in
|
||||||
# given that contains invalid characters.
|
# some identifier.
|
||||||
INVALID_NAME = "InvalidName"
|
INVALID_CHARS = "InvalidChars"
|
||||||
|
|
||||||
# Returned from the API when /compose is called without the POST body telling it
|
# Returned from the API when /compose is called without the POST body telling it
|
||||||
# what to compose.
|
# what to compose.
|
||||||
|
@ -1029,7 +1029,7 @@ def v0_api(api):
|
|||||||
"""List the available blueprints on a branch."""
|
"""List the available blueprints on a branch."""
|
||||||
branch = request.args.get("branch", "master")
|
branch = request.args.get("branch", "master")
|
||||||
if VALID_API_STRING.match(branch) is None:
|
if VALID_API_STRING.match(branch) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in branch argument"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in branch argument"}]), 400
|
||||||
|
|
||||||
try:
|
try:
|
||||||
limit = int(request.args.get("limit", "20"))
|
limit = int(request.args.get("limit", "20"))
|
||||||
@ -1048,15 +1048,15 @@ def v0_api(api):
|
|||||||
def v0_blueprints_info(blueprint_names):
|
def v0_blueprints_info(blueprint_names):
|
||||||
"""Return the contents of the blueprint, or a list of blueprints"""
|
"""Return the contents of the blueprint, or a list of blueprints"""
|
||||||
if VALID_API_STRING.match(blueprint_names) is None:
|
if VALID_API_STRING.match(blueprint_names) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in API path"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in API path"}]), 400
|
||||||
|
|
||||||
branch = request.args.get("branch", "master")
|
branch = request.args.get("branch", "master")
|
||||||
if VALID_API_STRING.match(branch) is None:
|
if VALID_API_STRING.match(branch) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in branch argument"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in branch argument"}]), 400
|
||||||
|
|
||||||
out_fmt = request.args.get("format", "json")
|
out_fmt = request.args.get("format", "json")
|
||||||
if VALID_API_STRING.match(out_fmt) is None:
|
if VALID_API_STRING.match(out_fmt) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in format argument"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in format argument"}]), 400
|
||||||
|
|
||||||
blueprints = []
|
blueprints = []
|
||||||
changes = []
|
changes = []
|
||||||
@ -1114,11 +1114,11 @@ def v0_api(api):
|
|||||||
def v0_blueprints_changes(blueprint_names):
|
def v0_blueprints_changes(blueprint_names):
|
||||||
"""Return the changes to a blueprint or list of blueprints"""
|
"""Return the changes to a blueprint or list of blueprints"""
|
||||||
if VALID_API_STRING.match(blueprint_names) is None:
|
if VALID_API_STRING.match(blueprint_names) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in API path"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in API path"}]), 400
|
||||||
|
|
||||||
branch = request.args.get("branch", "master")
|
branch = request.args.get("branch", "master")
|
||||||
if VALID_API_STRING.match(branch) is None:
|
if VALID_API_STRING.match(branch) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in branch argument"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in branch argument"}]), 400
|
||||||
|
|
||||||
try:
|
try:
|
||||||
limit = int(request.args.get("limit", "20"))
|
limit = int(request.args.get("limit", "20"))
|
||||||
@ -1154,7 +1154,7 @@ def v0_api(api):
|
|||||||
"""Commit a new blueprint"""
|
"""Commit a new blueprint"""
|
||||||
branch = request.args.get("branch", "master")
|
branch = request.args.get("branch", "master")
|
||||||
if VALID_API_STRING.match(branch) is None:
|
if VALID_API_STRING.match(branch) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in branch argument"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in branch argument"}]), 400
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if request.headers['Content-Type'] == "text/x-toml":
|
if request.headers['Content-Type'] == "text/x-toml":
|
||||||
@ -1163,7 +1163,7 @@ def v0_api(api):
|
|||||||
blueprint = recipe_from_dict(request.get_json(cache=False))
|
blueprint = recipe_from_dict(request.get_json(cache=False))
|
||||||
|
|
||||||
if VALID_API_STRING.match(blueprint["name"]) is None:
|
if VALID_API_STRING.match(blueprint["name"]) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in API path"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in API path"}]), 400
|
||||||
|
|
||||||
with api.config["GITLOCK"].lock:
|
with api.config["GITLOCK"].lock:
|
||||||
commit_recipe(api.config["GITLOCK"].repo, branch, blueprint)
|
commit_recipe(api.config["GITLOCK"].repo, branch, blueprint)
|
||||||
@ -1184,11 +1184,11 @@ def v0_api(api):
|
|||||||
def v0_blueprints_delete(blueprint_name):
|
def v0_blueprints_delete(blueprint_name):
|
||||||
"""Delete a blueprint from git"""
|
"""Delete a blueprint from git"""
|
||||||
if VALID_API_STRING.match(blueprint_name) is None:
|
if VALID_API_STRING.match(blueprint_name) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in API path"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in API path"}]), 400
|
||||||
|
|
||||||
branch = request.args.get("branch", "master")
|
branch = request.args.get("branch", "master")
|
||||||
if VALID_API_STRING.match(branch) is None:
|
if VALID_API_STRING.match(branch) is None:
|
||||||
return jsonify(status=False, errors=[{"id": INVALID_NAME, "msg": "Invalid characters in branch argument"}]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in branch argument"}]), 400
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with api.config["GITLOCK"].lock:
|
with api.config["GITLOCK"].lock:
|
||||||
@ -1205,7 +1205,7 @@ def v0_api(api):
|
|||||||
"""Write a blueprint to the workspace"""
|
"""Write a blueprint to the workspace"""
|
||||||
branch = request.args.get("branch", "master")
|
branch = request.args.get("branch", "master")
|
||||||
if VALID_API_STRING.match(branch) is None:
|
if VALID_API_STRING.match(branch) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in branch argument"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in branch argument"}]), 400
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if request.headers['Content-Type'] == "text/x-toml":
|
if request.headers['Content-Type'] == "text/x-toml":
|
||||||
@ -1214,7 +1214,7 @@ def v0_api(api):
|
|||||||
blueprint = recipe_from_dict(request.get_json(cache=False))
|
blueprint = recipe_from_dict(request.get_json(cache=False))
|
||||||
|
|
||||||
if VALID_API_STRING.match(blueprint["name"]) is None:
|
if VALID_API_STRING.match(blueprint["name"]) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in API path"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in API path"}]), 400
|
||||||
|
|
||||||
with api.config["GITLOCK"].lock:
|
with api.config["GITLOCK"].lock:
|
||||||
workspace_write(api.config["GITLOCK"].repo, branch, blueprint)
|
workspace_write(api.config["GITLOCK"].repo, branch, blueprint)
|
||||||
@ -1231,11 +1231,11 @@ def v0_api(api):
|
|||||||
def v0_blueprints_delete_workspace(blueprint_name):
|
def v0_blueprints_delete_workspace(blueprint_name):
|
||||||
"""Delete a blueprint from the workspace"""
|
"""Delete a blueprint from the workspace"""
|
||||||
if VALID_API_STRING.match(blueprint_name) is None:
|
if VALID_API_STRING.match(blueprint_name) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in API path"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in API path"}]), 400
|
||||||
|
|
||||||
branch = request.args.get("branch", "master")
|
branch = request.args.get("branch", "master")
|
||||||
if VALID_API_STRING.match(branch) is None:
|
if VALID_API_STRING.match(branch) is None:
|
||||||
return jsonify(status=False, errors=[{"id": INVALID_NAME, "msg": "Invalid characters in branch argument"}]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in branch argument"}]), 400
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with api.config["GITLOCK"].lock:
|
with api.config["GITLOCK"].lock:
|
||||||
@ -1255,11 +1255,11 @@ def v0_api(api):
|
|||||||
def v0_blueprints_undo(blueprint_name, commit):
|
def v0_blueprints_undo(blueprint_name, commit):
|
||||||
"""Undo changes to a blueprint by reverting to a previous commit."""
|
"""Undo changes to a blueprint by reverting to a previous commit."""
|
||||||
if VALID_API_STRING.match(blueprint_name) is None:
|
if VALID_API_STRING.match(blueprint_name) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in API path"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in API path"}]), 400
|
||||||
|
|
||||||
branch = request.args.get("branch", "master")
|
branch = request.args.get("branch", "master")
|
||||||
if VALID_API_STRING.match(branch) is None:
|
if VALID_API_STRING.match(branch) is None:
|
||||||
return jsonify(status=False, errors=[{"id": INVALID_NAME, "msg": "Invalid characters in branch argument"}]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in branch argument"}]), 400
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with api.config["GITLOCK"].lock:
|
with api.config["GITLOCK"].lock:
|
||||||
@ -1281,11 +1281,11 @@ def v0_api(api):
|
|||||||
def v0_blueprints_tag(blueprint_name):
|
def v0_blueprints_tag(blueprint_name):
|
||||||
"""Tag a blueprint's latest blueprint commit as a 'revision'"""
|
"""Tag a blueprint's latest blueprint commit as a 'revision'"""
|
||||||
if VALID_API_STRING.match(blueprint_name) is None:
|
if VALID_API_STRING.match(blueprint_name) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in API path"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in API path"}]), 400
|
||||||
|
|
||||||
branch = request.args.get("branch", "master")
|
branch = request.args.get("branch", "master")
|
||||||
if VALID_API_STRING.match(branch) is None:
|
if VALID_API_STRING.match(branch) is None:
|
||||||
return jsonify(status=False, errors=[{"id": INVALID_NAME, "msg": "Invalid characters in branch argument"}]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in branch argument"}]), 400
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with api.config["GITLOCK"].lock:
|
with api.config["GITLOCK"].lock:
|
||||||
@ -1308,11 +1308,11 @@ def v0_api(api):
|
|||||||
"""Return the differences between two commits of a blueprint"""
|
"""Return the differences between two commits of a blueprint"""
|
||||||
for s in [blueprint_name, from_commit, to_commit]:
|
for s in [blueprint_name, from_commit, to_commit]:
|
||||||
if VALID_API_STRING.match(s) is None:
|
if VALID_API_STRING.match(s) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in API path"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in API path"}]), 400
|
||||||
|
|
||||||
branch = request.args.get("branch", "master")
|
branch = request.args.get("branch", "master")
|
||||||
if VALID_API_STRING.match(branch) is None:
|
if VALID_API_STRING.match(branch) is None:
|
||||||
return jsonify(status=False, errors=[{"id": INVALID_NAME, "msg": "Invalid characters in branch argument"}]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in branch argument"}]), 400
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if from_commit == "NEWEST":
|
if from_commit == "NEWEST":
|
||||||
@ -1353,15 +1353,15 @@ def v0_api(api):
|
|||||||
def v0_blueprints_freeze(blueprint_names):
|
def v0_blueprints_freeze(blueprint_names):
|
||||||
"""Return the blueprint with the exact modules and packages selected by depsolve"""
|
"""Return the blueprint with the exact modules and packages selected by depsolve"""
|
||||||
if VALID_API_STRING.match(blueprint_names) is None:
|
if VALID_API_STRING.match(blueprint_names) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in API path"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in API path"}]), 400
|
||||||
|
|
||||||
branch = request.args.get("branch", "master")
|
branch = request.args.get("branch", "master")
|
||||||
if VALID_API_STRING.match(branch) is None:
|
if VALID_API_STRING.match(branch) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in branch argument"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in branch argument"}]), 400
|
||||||
|
|
||||||
out_fmt = request.args.get("format", "json")
|
out_fmt = request.args.get("format", "json")
|
||||||
if VALID_API_STRING.match(out_fmt) is None:
|
if VALID_API_STRING.match(out_fmt) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in format argument"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in format argument"}]), 400
|
||||||
|
|
||||||
blueprints = []
|
blueprints = []
|
||||||
errors = []
|
errors = []
|
||||||
@ -1417,11 +1417,11 @@ def v0_api(api):
|
|||||||
def v0_blueprints_depsolve(blueprint_names):
|
def v0_blueprints_depsolve(blueprint_names):
|
||||||
"""Return the dependencies for a blueprint"""
|
"""Return the dependencies for a blueprint"""
|
||||||
if VALID_API_STRING.match(blueprint_names) is None:
|
if VALID_API_STRING.match(blueprint_names) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in API path"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in API path"}]), 400
|
||||||
|
|
||||||
branch = request.args.get("branch", "master")
|
branch = request.args.get("branch", "master")
|
||||||
if VALID_API_STRING.match(branch) is None:
|
if VALID_API_STRING.match(branch) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in branch argument"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in branch argument"}]), 400
|
||||||
|
|
||||||
blueprints = []
|
blueprints = []
|
||||||
errors = []
|
errors = []
|
||||||
@ -1499,7 +1499,7 @@ def v0_api(api):
|
|||||||
def v0_projects_info(project_names):
|
def v0_projects_info(project_names):
|
||||||
"""Return detailed information about the listed projects"""
|
"""Return detailed information about the listed projects"""
|
||||||
if VALID_API_STRING.match(project_names) is None:
|
if VALID_API_STRING.match(project_names) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in API path"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in API path"}]), 400
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with api.config["YUMLOCK"].lock:
|
with api.config["YUMLOCK"].lock:
|
||||||
@ -1522,7 +1522,7 @@ def v0_api(api):
|
|||||||
def v0_projects_depsolve(project_names):
|
def v0_projects_depsolve(project_names):
|
||||||
"""Return detailed information about the listed projects"""
|
"""Return detailed information about the listed projects"""
|
||||||
if VALID_API_STRING.match(project_names) is None:
|
if VALID_API_STRING.match(project_names) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in API path"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in API path"}]), 400
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with api.config["YUMLOCK"].lock:
|
with api.config["YUMLOCK"].lock:
|
||||||
@ -1554,11 +1554,11 @@ def v0_api(api):
|
|||||||
def v0_projects_source_info(source_names):
|
def v0_projects_source_info(source_names):
|
||||||
"""Return detailed info about the list of sources"""
|
"""Return detailed info about the list of sources"""
|
||||||
if VALID_API_STRING.match(source_names) is None:
|
if VALID_API_STRING.match(source_names) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in API path"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in API path"}]), 400
|
||||||
|
|
||||||
out_fmt = request.args.get("format", "json")
|
out_fmt = request.args.get("format", "json")
|
||||||
if VALID_API_STRING.match(out_fmt) is None:
|
if VALID_API_STRING.match(out_fmt) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in format argument"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in format argument"}]), 400
|
||||||
|
|
||||||
# Return info on all of the sources
|
# Return info on all of the sources
|
||||||
if source_names == "*":
|
if source_names == "*":
|
||||||
@ -1655,7 +1655,7 @@ def v0_api(api):
|
|||||||
def v0_projects_source_delete(source_name):
|
def v0_projects_source_delete(source_name):
|
||||||
"""Delete the named source and return a status response"""
|
"""Delete the named source and return a status response"""
|
||||||
if VALID_API_STRING.match(source_name) is None:
|
if VALID_API_STRING.match(source_name) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in API path"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in API path"}]), 400
|
||||||
|
|
||||||
system_sources = get_repo_sources("/etc/yum.repos.d/*.repo")
|
system_sources = get_repo_sources("/etc/yum.repos.d/*.repo")
|
||||||
if source_name in system_sources:
|
if source_name in system_sources:
|
||||||
@ -1689,7 +1689,7 @@ def v0_api(api):
|
|||||||
def v0_modules_list(module_names=None):
|
def v0_modules_list(module_names=None):
|
||||||
"""List available modules, filtering by module_names"""
|
"""List available modules, filtering by module_names"""
|
||||||
if module_names and VALID_API_STRING.match(module_names) is None:
|
if module_names and VALID_API_STRING.match(module_names) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in API path"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in API path"}]), 400
|
||||||
|
|
||||||
try:
|
try:
|
||||||
limit = int(request.args.get("limit", "20"))
|
limit = int(request.args.get("limit", "20"))
|
||||||
@ -1722,7 +1722,7 @@ def v0_api(api):
|
|||||||
def v0_modules_info(module_names):
|
def v0_modules_info(module_names):
|
||||||
"""Return detailed information about the listed modules"""
|
"""Return detailed information about the listed modules"""
|
||||||
if VALID_API_STRING.match(module_names) is None:
|
if VALID_API_STRING.match(module_names) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in API path"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in API path"}]), 400
|
||||||
try:
|
try:
|
||||||
with api.config["YUMLOCK"].lock:
|
with api.config["YUMLOCK"].lock:
|
||||||
modules = modules_info(api.config["YUMLOCK"].yb, module_names.split(","))
|
modules = modules_info(api.config["YUMLOCK"].yb, module_names.split(","))
|
||||||
@ -1776,7 +1776,7 @@ def v0_api(api):
|
|||||||
compose_type = compose["compose_type"]
|
compose_type = compose["compose_type"]
|
||||||
|
|
||||||
if VALID_API_STRING.match(blueprint_name) is None:
|
if VALID_API_STRING.match(blueprint_name) is None:
|
||||||
errors.append("Invalid characters in API path")
|
errors.append({"id": INVALID_CHARS, "msg": "Invalid characters in API path"})
|
||||||
|
|
||||||
if errors:
|
if errors:
|
||||||
return jsonify(status=False, errors=errors), 400
|
return jsonify(status=False, errors=errors), 400
|
||||||
@ -1827,7 +1827,7 @@ def v0_api(api):
|
|||||||
def v0_compose_status(uuids):
|
def v0_compose_status(uuids):
|
||||||
"""Return the status of the listed uuids"""
|
"""Return the status of the listed uuids"""
|
||||||
if VALID_API_STRING.match(uuids) is None:
|
if VALID_API_STRING.match(uuids) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in API path"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in API path"}]), 400
|
||||||
|
|
||||||
results = []
|
results = []
|
||||||
errors = []
|
errors = []
|
||||||
@ -1847,7 +1847,7 @@ def v0_api(api):
|
|||||||
def v0_compose_cancel(uuid):
|
def v0_compose_cancel(uuid):
|
||||||
"""Cancel a running compose and delete its results directory"""
|
"""Cancel a running compose and delete its results directory"""
|
||||||
if VALID_API_STRING.match(uuid) is None:
|
if VALID_API_STRING.match(uuid) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in API path"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in API path"}]), 400
|
||||||
|
|
||||||
status = uuid_status(api.config["COMPOSER_CFG"], uuid)
|
status = uuid_status(api.config["COMPOSER_CFG"], uuid)
|
||||||
if status is None:
|
if status is None:
|
||||||
@ -1870,7 +1870,7 @@ def v0_api(api):
|
|||||||
def v0_compose_delete(uuids):
|
def v0_compose_delete(uuids):
|
||||||
"""Delete the compose results for the listed uuids"""
|
"""Delete the compose results for the listed uuids"""
|
||||||
if VALID_API_STRING.match(uuids) is None:
|
if VALID_API_STRING.match(uuids) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in API path"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in API path"}]), 400
|
||||||
|
|
||||||
results = []
|
results = []
|
||||||
errors = []
|
errors = []
|
||||||
@ -1896,7 +1896,7 @@ def v0_api(api):
|
|||||||
def v0_compose_info(uuid):
|
def v0_compose_info(uuid):
|
||||||
"""Return detailed info about a compose"""
|
"""Return detailed info about a compose"""
|
||||||
if VALID_API_STRING.match(uuid) is None:
|
if VALID_API_STRING.match(uuid) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in API path"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in API path"}]), 400
|
||||||
|
|
||||||
try:
|
try:
|
||||||
info = uuid_info(api.config["COMPOSER_CFG"], uuid)
|
info = uuid_info(api.config["COMPOSER_CFG"], uuid)
|
||||||
@ -1915,7 +1915,7 @@ def v0_api(api):
|
|||||||
def v0_compose_metadata(uuid):
|
def v0_compose_metadata(uuid):
|
||||||
"""Return a tar of the metadata for the build"""
|
"""Return a tar of the metadata for the build"""
|
||||||
if VALID_API_STRING.match(uuid) is None:
|
if VALID_API_STRING.match(uuid) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in API path"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in API path"}]), 400
|
||||||
|
|
||||||
status = uuid_status(api.config["COMPOSER_CFG"], uuid)
|
status = uuid_status(api.config["COMPOSER_CFG"], uuid)
|
||||||
if status is None:
|
if status is None:
|
||||||
@ -1935,7 +1935,7 @@ def v0_api(api):
|
|||||||
def v0_compose_results(uuid):
|
def v0_compose_results(uuid):
|
||||||
"""Return a tar of the metadata and the results for the build"""
|
"""Return a tar of the metadata and the results for the build"""
|
||||||
if VALID_API_STRING.match(uuid) is None:
|
if VALID_API_STRING.match(uuid) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in API path"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in API path"}]), 400
|
||||||
|
|
||||||
status = uuid_status(api.config["COMPOSER_CFG"], uuid)
|
status = uuid_status(api.config["COMPOSER_CFG"], uuid)
|
||||||
if status is None:
|
if status is None:
|
||||||
@ -1955,7 +1955,7 @@ def v0_api(api):
|
|||||||
def v0_compose_logs(uuid):
|
def v0_compose_logs(uuid):
|
||||||
"""Return a tar of the metadata for the build"""
|
"""Return a tar of the metadata for the build"""
|
||||||
if VALID_API_STRING.match(uuid) is None:
|
if VALID_API_STRING.match(uuid) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in API path"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in API path"}]), 400
|
||||||
|
|
||||||
status = uuid_status(api.config["COMPOSER_CFG"], uuid)
|
status = uuid_status(api.config["COMPOSER_CFG"], uuid)
|
||||||
if status is None:
|
if status is None:
|
||||||
@ -1975,7 +1975,7 @@ def v0_api(api):
|
|||||||
def v0_compose_image(uuid):
|
def v0_compose_image(uuid):
|
||||||
"""Return the output image for the build"""
|
"""Return the output image for the build"""
|
||||||
if VALID_API_STRING.match(uuid) is None:
|
if VALID_API_STRING.match(uuid) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in API path"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in API path"}]), 400
|
||||||
|
|
||||||
status = uuid_status(api.config["COMPOSER_CFG"], uuid)
|
status = uuid_status(api.config["COMPOSER_CFG"], uuid)
|
||||||
if status is None:
|
if status is None:
|
||||||
@ -2001,7 +2001,7 @@ def v0_api(api):
|
|||||||
def v0_compose_log_tail(uuid):
|
def v0_compose_log_tail(uuid):
|
||||||
"""Return the end of the main anaconda.log, defaults to 1Mbytes"""
|
"""Return the end of the main anaconda.log, defaults to 1Mbytes"""
|
||||||
if VALID_API_STRING.match(uuid) is None:
|
if VALID_API_STRING.match(uuid) is None:
|
||||||
return jsonify(status=False, errors=["Invalid characters in API path"]), 400
|
return jsonify(status=False, errors=[{"id": INVALID_CHARS, "msg": "Invalid characters in API path"}]), 400
|
||||||
|
|
||||||
try:
|
try:
|
||||||
size = int(request.args.get("size", "1024"))
|
size = int(request.args.get("size", "1024"))
|
||||||
|
Loading…
Reference in New Issue
Block a user