diff --git a/changes/1810.fix.md b/changes/1810.fix.md new file mode 100644 index 00000000000..5d91bede924 --- /dev/null +++ b/changes/1810.fix.md @@ -0,0 +1 @@ +Fix an issue in the `ModifyContainerRegistry` mutation where the `url` was not updating due to a key mismatch. diff --git a/src/ai/backend/manager/models/etcd.py b/src/ai/backend/manager/models/etcd.py index 9f642e2f01e..b6436d1a104 100644 --- a/src/ai/backend/manager/models/etcd.py +++ b/src/ai/backend/manager/models/etcd.py @@ -164,6 +164,8 @@ async def mutate( set_if_set(props, input_config, "username") set_if_set(props, input_config, "password") set_if_set(props, input_config, "ssl_verify") + if "url" in input_config: + input_config[""] = input_config.pop("url") log.info( "ETCD.MODIFY_CONTAINER_REGISTRY (ak:{}, hostname:{}, config:{})", ctx.access_key, diff --git a/tests/manager/models/test_etcd.py b/tests/manager/models/test_etcd.py index 66c9c9e3f6e..7996e7b3e16 100644 --- a/tests/manager/models/test_etcd.py +++ b/tests/manager/models/test_etcd.py @@ -122,6 +122,7 @@ async def test_modify_container_registry(client: Client, context: GraphQueryCont variables = { "hostname": "cr.example.com", "props": { + "url": "http://cr2.example.com", "type": "harbor2", "project": ["default", "example"], }, @@ -130,7 +131,7 @@ async def test_modify_container_registry(client: Client, context: GraphQueryCont response = await client.execute_async(query, variables=variables, context_value=context) container_registry = response["data"]["modify_container_registry"]["container_registry"] assert container_registry["hostname"] == "cr.example.com" - assert container_registry["config"]["url"] == "http://cr.example.com" + assert container_registry["config"]["url"] == "http://cr2.example.com" assert container_registry["config"]["type"] == "harbor2" assert container_registry["config"]["project"] == ["default", "example"] assert container_registry["config"]["username"] == "username2" @@ -162,7 +163,7 @@ async def test_modify_container_registry_allows_empty_string( response = await client.execute_async(query, variables=variables, context_value=context) container_registry = response["data"]["modify_container_registry"]["container_registry"] assert container_registry["hostname"] == "cr.example.com" - assert container_registry["config"]["url"] == "http://cr.example.com" + assert container_registry["config"]["url"] == "http://cr2.example.com" assert container_registry["config"]["type"] == "harbor2" assert container_registry["config"]["project"] == ["default", "example"] assert container_registry["config"]["username"] == "username2" @@ -198,7 +199,7 @@ async def test_modify_container_registry_allows_null_for_unset( response = await client.execute_async(query, variables=variables, context_value=context) container_registry = response["data"]["modify_container_registry"]["container_registry"] assert container_registry["hostname"] == "cr.example.com" - assert container_registry["config"]["url"] == "http://cr.example.com" + assert container_registry["config"]["url"] == "http://cr2.example.com" assert container_registry["config"]["type"] == "harbor2" assert container_registry["config"]["project"] == ["default", "example"] assert container_registry["config"]["username"] == "username2"