Merge pull request 'clan_lib: fix update_service:_instance api name' (#5201) from api-update-service into main

Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/5201
This commit is contained in:
hsjobeki
2025-09-18 14:46:00 +00:00
2 changed files with 7 additions and 8 deletions

View File

@@ -434,7 +434,7 @@ def list_service_instances(flake: Flake) -> dict[str, InventoryInstanceInfo]:
@API.register
def update_service_instance(
def set_service_instance(
flake: Flake, instance_ref: str, roles: InventoryInstanceRolesType
) -> None:
"""Update the roles of a service instance

View File

@@ -5,15 +5,14 @@ import pytest
from clan_cli.tests.fixtures_flakes import nested_dict
from clan_lib.errors import ClanError
from clan_lib.flake.flake import Flake
from clan_lib.nix_models.clan import Inventory
from clan_lib.services.modules import (
list_service_instances,
list_service_modules,
update_service_instance,
set_service_instance,
)
if TYPE_CHECKING:
from clan_lib.nix_models.clan import Clan
from clan_lib.nix_models.clan import Clan, Inventory
@pytest.mark.with_core
@@ -152,7 +151,7 @@ def test_update_service_instance(
# Wrong instance
with pytest.raises(ClanError) as excinfo:
update_service_instance(
set_service_instance(
flake,
"admin",
{},
@@ -161,7 +160,7 @@ def test_update_service_instance(
# Wrong roles
with pytest.raises(ClanError) as excinfo:
update_service_instance(
set_service_instance(
flake,
"hello-world",
{"default": {"machines": {}}},
@@ -169,7 +168,7 @@ def test_update_service_instance(
assert "Role 'default' cannot be used" in str(excinfo.value)
# Remove 'settings' from jon machine
update_service_instance(
set_service_instance(
flake,
"hello-world",
{
@@ -197,7 +196,7 @@ def test_update_service_instance(
}
# Remove jon
update_service_instance(
set_service_instance(
flake,
"hello-world",
{