From 1160ab66e9c25e22dc35c6c4febad525b13d3a80 Mon Sep 17 00:00:00 2001 From: Marek Skrobacki Date: Wed, 25 Sep 2024 09:15:20 +0100 Subject: [PATCH] sync_interfaces: make the port names unique --- .../understack_workflows/port_configuration.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/python/understack-workflows/understack_workflows/port_configuration.py b/python/understack-workflows/understack_workflows/port_configuration.py index 1e26566ec..2ac369017 100644 --- a/python/understack-workflows/understack_workflows/port_configuration.py +++ b/python/understack-workflows/understack_workflows/port_configuration.py @@ -2,6 +2,7 @@ from pydantic import BaseModel from pydantic import StringConstraints +from pydantic import field_serializer class PortConfiguration(BaseModel): @@ -11,3 +12,8 @@ class PortConfiguration(BaseModel): uuid: str # using a str here to due to ironicclient Port attribute node_uuid: str # using a str here due to ironicclient Port attribute name: str # port name + + # Ironic requires the port names to be globally unique + @field_serializer('name') + def serialize_name(self, name: str): + return f"{self.uuid} {name}"