Skip to content

Commit

Permalink
Restore set_if_set of CreateContainerRegistry.mutate
Browse files Browse the repository at this point in the history
  • Loading branch information
jopemachine committed Feb 20, 2024
1 parent 00959c7 commit 14f2da3
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/ai/backend/manager/models/container_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,18 +185,18 @@ async def mutate(
) -> CreateContainerRegistry:
ctx: GraphQueryContext = info.context

data = {
"hostname": hostname,
"url": props.url,
"type": props.type,
"project": ",".join(props.project) if props.project is not None else None,
"username": props.username,
"password": props.password,
"ssl_verify": props.ssl_verify,
}
input_config: Dict[str, Any] = {"hostname": hostname, "url": props.url, "type": props.type}

set_if_set(props, input_config, "username")
set_if_set(props, input_config, "password")
set_if_set(props, input_config, "ssl_verify")
set_if_set(props, input_config, "project")

if "project" in input_config.keys():
input_config["project"] = ",".join(input_config["project"])

async with ctx.db.begin_session() as session:
query = sa.insert(ContainerRegistryRow).values(data)
query = sa.insert(ContainerRegistryRow).values(input_config)
await session.execute(query)

container_registry = await ContainerRegistry.load_registry(ctx, hostname)
Expand Down Expand Up @@ -229,10 +229,10 @@ async def mutate(

set_if_set(props, input_config, "url")
set_if_set(props, input_config, "type")
set_if_set(props, input_config, "project")
set_if_set(props, input_config, "username")
set_if_set(props, input_config, "password")
set_if_set(props, input_config, "ssl_verify")
set_if_set(props, input_config, "project")

if "project" in input_config.keys():
input_config["project"] = ",".join(input_config["project"])
Expand Down

0 comments on commit 14f2da3

Please sign in to comment.