Skip to content

Commit 337875c

Browse files
author
Jeny Sadadia
committed
api.main: translate node version fields
API expects `int` values for Node version information. Translate version fields received in the `POST` node handler until we can use it in the pipeline service directly. Due to python version conflicts between core tools and pipeline, we are not able to use the helper function in the pipeline atm. Signed-off-by: Jeny Sadadia <[email protected]>
1 parent eb358a4 commit 337875c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

api/main.py

+8
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
Hierarchy,
3333
PublishEvent,
3434
parse_node_obj,
35+
KernelVersion,
3536
)
3637
from .auth import Authentication
3738
from .db import Database
@@ -539,6 +540,13 @@ async def _verify_user_group_existence(user_groups: List[str]):
539540
async def post_node(node: Node,
540541
current_user: User = Depends(get_current_user)):
541542
"""Create a new node"""
543+
# [TODO] Remove translation below once we can use it in the pipeline
544+
data = node.data
545+
if data:
546+
version = data.get('kernel_revision', {}).get('version')
547+
if version:
548+
version = KernelVersion.translate_version_fields(version)
549+
node.data['kernel_revision']['version'] = version
542550
# Explicit pydantic model validation
543551
parse_node_obj(node)
544552

0 commit comments

Comments
 (0)