Fix repository already exists error code
parent
52fd7d8064
commit
990d11051e
|
@ -2367,7 +2367,7 @@ def git_create_repository():
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Response: A JSON response with a status message and HTTP status code.
|
Response: A JSON response with a status message and HTTP status code.
|
||||||
- 200: If the repository already exists.
|
- 409: If the repository already exists.
|
||||||
- 201: If the repository is successfully created.
|
- 201: If the repository is successfully created.
|
||||||
"""
|
"""
|
||||||
data = request.json
|
data = request.json
|
||||||
|
@ -2381,7 +2381,7 @@ def git_create_repository():
|
||||||
repo_path = os.path.join(REPOSITORIES_BASE_PATH, repo + ".git")
|
repo_path = os.path.join(REPOSITORIES_BASE_PATH, repo + ".git")
|
||||||
if os.path.isdir(repo_path):
|
if os.path.isdir(repo_path):
|
||||||
journal.send(f"Can't create repository {repo}, already exists at {repo_path}", PRIORITY=journal.LOG_ERR, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
|
journal.send(f"Can't create repository {repo}, already exists at {repo_path}", PRIORITY=journal.LOG_ERR, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
|
||||||
return jsonify({"status": "Repository already exists"}), 200
|
return jsonify({"status": "Repository already exists"}), 409
|
||||||
|
|
||||||
module = _load_installer()
|
module = _load_installer()
|
||||||
print(f"Got {module}")
|
print(f"Got {module}")
|
||||||
|
@ -2531,7 +2531,7 @@ def git_create_branch(repo, branch):
|
||||||
Response: A JSON response containing a creation status
|
Response: A JSON response containing a creation status
|
||||||
- 201: A JSON object with a "status" key containing "created"
|
- 201: A JSON object with a "status" key containing "created"
|
||||||
- 404: A JSON object with an "error" key containing the message "Repository not found"
|
- 404: A JSON object with an "error" key containing the message "Repository not found"
|
||||||
- 409: A JSON object with an "error" key containing the message "Tag already exists"
|
- 409: A JSON object with an "error" key containing the message "Branch already exists"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
repo_path = os.path.join(REPOSITORIES_BASE_PATH, repo + ".git")
|
repo_path = os.path.join(REPOSITORIES_BASE_PATH, repo + ".git")
|
||||||
|
|
Loading…
Reference in New Issue