enable bug-bear linting rules
This commit is contained in:
@@ -209,7 +209,7 @@ def generate_machine_hardware_info(
|
||||
"Invalid hardware-configuration.nix file",
|
||||
description="The hardware-configuration.nix file is invalid. Please check the file and try again.",
|
||||
location=f"{__name__} {hw_file}",
|
||||
)
|
||||
) from e
|
||||
|
||||
return HardwareReport(report_type)
|
||||
|
||||
|
||||
@@ -29,8 +29,10 @@ def install_nixos(
|
||||
debug: bool = False,
|
||||
password: str | None = None,
|
||||
no_reboot: bool = False,
|
||||
extra_args: list[str] = [],
|
||||
extra_args: list[str] | None = None,
|
||||
) -> None:
|
||||
if extra_args is None:
|
||||
extra_args = []
|
||||
secret_facts_module = importlib.import_module(machine.secret_facts_module)
|
||||
log.info(f"installing {machine.name}")
|
||||
secret_facts_store = secret_facts_module.SecretStore(machine=machine)
|
||||
|
||||
@@ -73,7 +73,7 @@ def list_nixos_machines(flake_url: str | Path) -> list[str]:
|
||||
data = json.loads(res)
|
||||
return data
|
||||
except json.JSONDecodeError as e:
|
||||
raise ClanError(f"Error decoding machines from flake: {e}")
|
||||
raise ClanError(f"Error decoding machines from flake: {e}") from e
|
||||
|
||||
|
||||
@dataclass
|
||||
|
||||
@@ -133,12 +133,14 @@ class Machine:
|
||||
attr: str,
|
||||
extra_config: None | dict = None,
|
||||
impure: bool = False,
|
||||
nix_options: list[str] = [],
|
||||
nix_options: list[str] | None = None,
|
||||
) -> str | Path:
|
||||
"""
|
||||
Build the machine and return the path to the result
|
||||
accepts a secret store and a facts store # TODO
|
||||
"""
|
||||
if nix_options is None:
|
||||
nix_options = []
|
||||
config = nix_config()
|
||||
system = config["system"]
|
||||
|
||||
@@ -216,12 +218,14 @@ class Machine:
|
||||
refresh: bool = False,
|
||||
extra_config: None | dict = None,
|
||||
impure: bool = False,
|
||||
nix_options: list[str] = [],
|
||||
nix_options: list[str] | None = None,
|
||||
) -> str:
|
||||
"""
|
||||
eval a nix attribute of the machine
|
||||
@attr: the attribute to get
|
||||
"""
|
||||
if nix_options is None:
|
||||
nix_options = []
|
||||
if attr in self._eval_cache and not refresh and extra_config is None:
|
||||
return self._eval_cache[attr]
|
||||
|
||||
@@ -238,13 +242,15 @@ class Machine:
|
||||
refresh: bool = False,
|
||||
extra_config: None | dict = None,
|
||||
impure: bool = False,
|
||||
nix_options: list[str] = [],
|
||||
nix_options: list[str] | None = None,
|
||||
) -> Path:
|
||||
"""
|
||||
build a nix attribute of the machine
|
||||
@attr: the attribute to get
|
||||
"""
|
||||
|
||||
if nix_options is None:
|
||||
nix_options = []
|
||||
if attr in self._build_cache and not refresh and extra_config is None:
|
||||
return self._build_cache[attr]
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ def upload_sources(
|
||||
except (json.JSONDecodeError, OSError) as e:
|
||||
raise ClanError(
|
||||
f"failed to parse output of {shlex.join(cmd)}: {e}\nGot: {proc.stdout}"
|
||||
)
|
||||
) from e
|
||||
|
||||
|
||||
@API.register
|
||||
@@ -180,7 +180,7 @@ def update(args: argparse.Namespace) -> None:
|
||||
if machine.deployment.get("requireExplicitUpdate", False):
|
||||
continue
|
||||
try:
|
||||
machine.build_host
|
||||
machine.build_host # noqa: B018
|
||||
except ClanError: # check if we have a build host set
|
||||
ignored_machines.append(machine)
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user