Machine __str__ impl
All checks were successful
checks-impure / test (pull_request) Successful in 1m24s
checks / test (pull_request) Successful in 2m37s

This commit is contained in:
Luis Hebendanz 2024-01-30 15:32:35 +07:00
parent a3207f7011
commit 649e345585
2 changed files with 9 additions and 3 deletions

View File

@ -31,6 +31,12 @@ class Machine:
if deployment_info is not None:
self.deployment_info = deployment_info
def __str__(self) -> str:
return f"Machine(name={self.name}, flake={self.flake})"
def __repr__(self) -> str:
return str(self)
def get_deployment_info(self) -> None:
self.deployment_info = json.loads(
self.build_nix("config.system.clan.deployment.file").read_text()

View File

@ -189,9 +189,9 @@ class ClanList(Gtk.Box):
def vm_status_changed(self, switch: Gtk.Switch, vm: VM, _vm: VM) -> None:
switch.set_active(vm.is_running())
switch.set_state(vm.is_running())
print("====> Set switch to", vm.is_running())
exitc = vm.process.proc.exitcode
if not vm.is_running() and exitc != 0 and exitc != -15:
print("VM exited with code:", exitc)
if not vm.is_running() and exitc != 0:
print("VM exited with error. Exitcode:", exitc)
print(vm.read_log())
self.show_error_dialog(vm.read_log())
# self.show_error_dialog(vm.read_log())