rename nix_shell_legacy to nix_shell and run_cmd to nix_shell

Than it's more obvious that we need to migrate.
This commit is contained in:
Jörg Thalheim
2025-04-16 19:57:13 +02:00
committed by Mic92
parent ed123d2332
commit 837789010e
24 changed files with 69 additions and 65 deletions

View File

@@ -2,19 +2,21 @@ import subprocess
from pathlib import Path
import pytest
from clan_cli.nix import nix_shell
from clan_cli.nix import nix_shell_legacy
# fixture for git_repo
@pytest.fixture
def git_repo(temp_dir: Path) -> Path:
# initialize a git repository
cmd = nix_shell(["nixpkgs#git"], ["git", "init"])
cmd = nix_shell_legacy(["nixpkgs#git"], ["git", "init"])
subprocess.run(cmd, cwd=temp_dir, check=True)
# set user.name and user.email
cmd = nix_shell(["nixpkgs#git"], ["git", "config", "user.name", "test"])
cmd = nix_shell_legacy(["nixpkgs#git"], ["git", "config", "user.name", "test"])
subprocess.run(cmd, cwd=temp_dir, check=True)
cmd = nix_shell(["nixpkgs#git"], ["git", "config", "user.email", "test@test.test"])
cmd = nix_shell_legacy(
["nixpkgs#git"], ["git", "config", "user.email", "test@test.test"]
)
subprocess.run(cmd, cwd=temp_dir, check=True)
# return the path to the git repository
return temp_dir

View File

@@ -6,7 +6,7 @@ from clan_cli.facts.secret_modules.password_store import SecretStore
from clan_cli.flake import Flake
from clan_cli.machines.facts import machine_get_fact
from clan_cli.machines.machines import Machine
from clan_cli.nix import nix_shell
from clan_cli.nix import nix_shell_legacy
from clan_cli.ssh.host import Host
from clan_cli.tests.fixtures_flakes import ClanFlake
from clan_cli.tests.helpers import cli
@@ -58,13 +58,13 @@ def test_upload_secret(
"""
)
subprocess.run(
nix_shell(
nix_shell_legacy(
["nixpkgs#gnupg"], ["gpg", "--batch", "--gen-key", str(gpg_key_spec)]
),
check=True,
)
subprocess.run(
nix_shell(["nixpkgs#pass"], ["pass", "init", "test@local"]), check=True
nix_shell_legacy(["nixpkgs#pass"], ["pass", "init", "test@local"]), check=True
)
cli.run(["facts", "generate", "vm1", "--flake", str(flake.path)])