Host: migrate from nix_shell to run_cmd
This commit is contained in:
@@ -105,6 +105,7 @@ def nix_metadata(flake_url: str | Path) -> dict[str, Any]:
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
# Deprecated: use run_cmd() instead
|
||||||
def nix_shell(packages: list[str], cmd: list[str]) -> list[str]:
|
def nix_shell(packages: list[str], cmd: list[str]) -> list[str]:
|
||||||
# we cannot use nix-shell inside the nix sandbox
|
# we cannot use nix-shell inside the nix sandbox
|
||||||
# in our tests we just make sure we have all the packages
|
# in our tests we just make sure we have all the packages
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
"pass",
|
"pass",
|
||||||
"sops",
|
"sops",
|
||||||
"sshpass",
|
"sshpass",
|
||||||
|
"netcat",
|
||||||
"tor",
|
"tor",
|
||||||
"virtiofsd",
|
"virtiofsd",
|
||||||
"zbar",
|
"zbar",
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ from typing import Any
|
|||||||
from clan_cli.cmd import CmdOut, RunOpts, run
|
from clan_cli.cmd import CmdOut, RunOpts, run
|
||||||
from clan_cli.colors import AnsiColor
|
from clan_cli.colors import AnsiColor
|
||||||
from clan_cli.errors import ClanError
|
from clan_cli.errors import ClanError
|
||||||
from clan_cli.nix import nix_shell
|
from clan_cli.nix import run_cmd
|
||||||
from clan_cli.ssh.host_key import HostKeyCheck
|
from clan_cli.ssh.host_key import HostKeyCheck
|
||||||
|
|
||||||
cmdlog = logging.getLogger(__name__)
|
cmdlog = logging.getLogger(__name__)
|
||||||
@@ -186,7 +186,7 @@ class Host:
|
|||||||
packages = []
|
packages = []
|
||||||
password_args = []
|
password_args = []
|
||||||
if password:
|
if password:
|
||||||
packages.append("nixpkgs#sshpass")
|
packages.append("sshpass")
|
||||||
password_args = [
|
password_args = [
|
||||||
"sshpass",
|
"sshpass",
|
||||||
"-p",
|
"-p",
|
||||||
@@ -205,7 +205,7 @@ class Host:
|
|||||||
ssh_opts.extend(["-i", self.key])
|
ssh_opts.extend(["-i", self.key])
|
||||||
|
|
||||||
if tor_socks:
|
if tor_socks:
|
||||||
packages.append("nixpkgs#netcat")
|
packages.append("netcat")
|
||||||
ssh_opts.append("-o")
|
ssh_opts.append("-o")
|
||||||
ssh_opts.append("ProxyCommand=nc -x 127.0.0.1:9050 -X 5 %h %p")
|
ssh_opts.append("ProxyCommand=nc -x 127.0.0.1:9050 -X 5 %h %p")
|
||||||
|
|
||||||
@@ -216,7 +216,7 @@ class Host:
|
|||||||
*ssh_opts,
|
*ssh_opts,
|
||||||
]
|
]
|
||||||
|
|
||||||
return nix_shell(packages, cmd)
|
return run_cmd(packages, cmd)
|
||||||
|
|
||||||
def connect_ssh_shell(
|
def connect_ssh_shell(
|
||||||
self, *, password: str | None = None, tor_socks: bool = False
|
self, *, password: str | None = None, tor_socks: bool = False
|
||||||
|
|||||||
Reference in New Issue
Block a user