nixos-rebuild-ng: Profile.from_name -> Profile.from_arg
This commit is contained in:
@@ -167,7 +167,7 @@ def execute(argv: list[str]) -> None:
|
||||
tmpdir_path = Path(tmpdir.name)
|
||||
atexit.register(cleanup_ssh, tmpdir_path)
|
||||
|
||||
profile = Profile.from_name(args.profile_name)
|
||||
profile = Profile.from_arg(args.profile_name)
|
||||
target_host = Remote.from_arg(args.target_host, args.ask_sudo_password, tmpdir_path)
|
||||
build_attr = BuildAttr.from_arg(args.attr, args.file)
|
||||
flake = Flake.from_arg(args.flake, target_host)
|
||||
|
||||
@@ -137,7 +137,7 @@ class Profile:
|
||||
path: Path
|
||||
|
||||
@classmethod
|
||||
def from_name(cls, name: str = "system") -> Self:
|
||||
def from_arg(cls, name: str) -> Self:
|
||||
match name:
|
||||
case "system":
|
||||
return cls(name, Path("/nix/var/nix/profiles/system"))
|
||||
|
||||
@@ -111,13 +111,13 @@ def test_flake_from_arg(mock_node: Any) -> None:
|
||||
|
||||
|
||||
@patch(get_qualified_name(m.Path.mkdir, m), autospec=True)
|
||||
def test_profile_from_name(mock_mkdir: Any) -> None:
|
||||
assert m.Profile.from_name("system") == m.Profile(
|
||||
def test_profile_from_arg(mock_mkdir: Any) -> None:
|
||||
assert m.Profile.from_arg("system") == m.Profile(
|
||||
"system",
|
||||
Path("/nix/var/nix/profiles/system"),
|
||||
)
|
||||
|
||||
assert m.Profile.from_name("something") == m.Profile(
|
||||
assert m.Profile.from_arg("something") == m.Profile(
|
||||
"something",
|
||||
Path("/nix/var/nix/profiles/system-profiles/something"),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user