enable bug-bear linting rules
This commit is contained in:
@@ -94,8 +94,10 @@ def qemu_command(
|
||||
virtiofsd_socket: Path,
|
||||
qmp_socket_file: Path,
|
||||
qga_socket_file: Path,
|
||||
portmap: list[tuple[int, int]] = [],
|
||||
portmap: list[tuple[int, int]] | None = None,
|
||||
) -> QemuCommand:
|
||||
if portmap is None:
|
||||
portmap = []
|
||||
kernel_cmdline = [
|
||||
(Path(nixos_config["toplevel"]) / "kernel-params").read_text(),
|
||||
f'init={nixos_config["toplevel"]}/init',
|
||||
|
||||
@@ -39,9 +39,11 @@ def facts_to_nixos_config(facts: dict[str, dict[str, bytes]]) -> dict:
|
||||
|
||||
# TODO move this to the Machines class
|
||||
def build_vm(
|
||||
machine: Machine, tmpdir: Path, nix_options: list[str] = []
|
||||
machine: Machine, tmpdir: Path, nix_options: list[str] | None = None
|
||||
) -> dict[str, str]:
|
||||
# TODO pass prompt here for the GTK gui
|
||||
if nix_options is None:
|
||||
nix_options = []
|
||||
secrets_dir = get_secrets(machine, tmpdir)
|
||||
|
||||
public_facts_module = importlib.import_module(machine.public_facts_module)
|
||||
@@ -58,7 +60,7 @@ def build_vm(
|
||||
vm_data["secrets_dir"] = str(secrets_dir)
|
||||
return vm_data
|
||||
except json.JSONDecodeError as e:
|
||||
raise ClanError(f"Failed to parse vm config: {e}")
|
||||
raise ClanError(f"Failed to parse vm config: {e}") from e
|
||||
|
||||
|
||||
def get_secrets(
|
||||
@@ -108,9 +110,13 @@ def run_vm(
|
||||
*,
|
||||
cachedir: Path | None = None,
|
||||
socketdir: Path | None = None,
|
||||
nix_options: list[str] = [],
|
||||
portmap: list[tuple[int, int]] = [],
|
||||
nix_options: list[str] | None = None,
|
||||
portmap: list[tuple[int, int]] | None = None,
|
||||
) -> None:
|
||||
if portmap is None:
|
||||
portmap = []
|
||||
if nix_options is None:
|
||||
nix_options = []
|
||||
with ExitStack() as stack:
|
||||
machine = Machine(name=vm.machine_name, flake=vm.flake_url)
|
||||
log.debug(f"Creating VM for {machine}")
|
||||
|
||||
Reference in New Issue
Block a user