cli: don't update macOS machines
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
import importlib
|
||||
import json
|
||||
import logging
|
||||
import re
|
||||
from dataclasses import dataclass, field
|
||||
from functools import cached_property
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING, Any, Literal
|
||||
|
||||
from clan_cli.errors import ClanError
|
||||
from clan_cli.errors import ClanCmdError, ClanError
|
||||
from clan_cli.facts import public_modules as facts_public_modules
|
||||
from clan_cli.facts import secret_modules as facts_secret_modules
|
||||
from clan_cli.flake import Flake
|
||||
@@ -56,10 +57,22 @@ class Machine:
|
||||
kwargs.update({"extra": {"command_prefix": self.name}})
|
||||
log.error(msg, *args, **kwargs)
|
||||
|
||||
@property
|
||||
# `class` is a keyword, `_class` triggers `SLF001` so we use a sunder name
|
||||
def _class_(self) -> str:
|
||||
try:
|
||||
return self.flake.select(
|
||||
f"clanInternals.inventory.machineClass.{self.name}"
|
||||
)
|
||||
except ClanCmdError as e:
|
||||
if re.search(f"error: attribute '{self.name}' missing", e.cmd.stderr):
|
||||
return "nixos"
|
||||
raise
|
||||
|
||||
@property
|
||||
def system(self) -> str:
|
||||
return self.flake.select(
|
||||
f"nixosConfigurations.{self.name}.pkgs.hostPlatform.system"
|
||||
f"{self._class_}Configurations.{self.name}.pkgs.hostPlatform.system"
|
||||
)
|
||||
|
||||
@property
|
||||
|
||||
@@ -238,6 +238,8 @@ def update_command(args: argparse.Namespace) -> None:
|
||||
if len(args.machines) == 0:
|
||||
ignored_machines = []
|
||||
for machine in get_all_machines(args.flake, args.option):
|
||||
if machine._class_ == "darwin":
|
||||
continue
|
||||
if machine.deployment.get("requireExplicitUpdate", False):
|
||||
continue
|
||||
try:
|
||||
@@ -265,6 +267,11 @@ def update_command(args: argparse.Namespace) -> None:
|
||||
machine.override_build_host = args.build_host
|
||||
machine.host_key_check = HostKeyCheck.from_str(args.host_key_check)
|
||||
|
||||
for machine in machines:
|
||||
if machine._class_ == "darwin":
|
||||
machine.error("Updating macOS machines is not yet supported")
|
||||
sys.exit(1)
|
||||
|
||||
deploy_machines(machines)
|
||||
except KeyboardInterrupt:
|
||||
log.warning("Interrupted by user")
|
||||
|
||||
Reference in New Issue
Block a user