clan_cli machines: use Flake instead of FlakeId

This commit is contained in:
lassulus
2025-02-06 04:51:28 +01:00
parent cf1a4f805c
commit 2a8f40e91a
47 changed files with 242 additions and 251 deletions

View File

@@ -147,20 +147,14 @@ class VMObject(GObject.Object):
uri = ClanURI.from_str(
url=str(self.data.flake.flake_url), machine_name=self.data.flake.flake_attr
)
if uri.flake.is_local():
self.machine = Machine(
name=self.data.flake.flake_attr,
flake=uri.flake,
)
if uri.flake.is_remote():
self.machine = Machine(
name=self.data.flake.flake_attr,
flake=uri.flake,
)
self.machine = Machine(
name=self.data.flake.flake_attr,
flake=uri.flake,
)
assert self.machine is not None
state_dir = vm_state_dir(
flake_url=self.machine.flake, vm_name=self.machine.name
flake_url=self.machine.flake.identifier, vm_name=self.machine.name
)
self.qmp_wrap = QMPWrapper(state_dir)
assert self.machine is not None

View File

@@ -4,7 +4,8 @@ from pathlib import Path
from typing import Any, ClassVar
import gi
from clan_cli.clan_uri import ClanURI, FlakeId
from clan_cli.clan_uri import ClanURI
from clan_cli.flake import Flake
from clan_cli.history.add import HistoryEntry
from clan_cli.machines.machines import Machine
@@ -34,7 +35,7 @@ class Emitter(GObject.GObject):
class ClanStore:
_instance: "None | ClanStore" = None
_clan_store: GKVStore[FlakeId, VMStore]
_clan_store: GKVStore[Flake, VMStore]
_emitter: Emitter
@@ -94,7 +95,7 @@ class ClanStore:
self.clan_store.register_on_change(on_clanstore_change)
@property
def clan_store(self) -> GKVStore[FlakeId, VMStore]:
def clan_store(self) -> GKVStore[Flake, VMStore]:
return self._clan_store
def create_vm_task(self, vm: HistoryEntry) -> bool: