mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-02-09 00:03:17 +08:00
Check whether the module already exists in the database
Signed-off-by: Petr Šabata <contyk@redhat.com>
This commit is contained in:
@@ -124,6 +124,7 @@ Possible response codes are for various requests include:
|
||||
- HTTP 403 Forbidden - The SCM URL is not pointing to a whitelisted SCM server.
|
||||
- HTTP 404 Not Found - The requested URL has no handler associated with it or
|
||||
the requested resource doesn't exist.
|
||||
- HTTP 409 Conflict - The submitted module's NVR already exists.
|
||||
- HTTP 422 Unprocessable Entity - The submitted modulemd file is not valid or
|
||||
the module components cannot be retrieved
|
||||
- HTTP 500 Internal Server Error - An unknown error occured.
|
||||
|
||||
3
rida.py
3
rida.py
@@ -99,6 +99,9 @@ def submit_build():
|
||||
mmd.loads(yaml)
|
||||
except:
|
||||
return "Invalid modulemd", 422
|
||||
if db.session.query(rida.database.Module).filter_by(name=mmd.name,
|
||||
version=mmd.version, release=mmd.release).first():
|
||||
return "Module already exists", 409
|
||||
module = rida.database.Module(name=mmd.name, version=mmd.version,
|
||||
release=mmd.release, state="init", modulemd=yaml)
|
||||
db.session.add(module)
|
||||
|
||||
Reference in New Issue
Block a user