fix: full sshpass support for password-based transfer; pre-flight SSH check; clear error diagnostics
This commit is contained in:
@@ -147,6 +147,21 @@ def manual_copy_instructions(host, user, port, pubkey_path):
|
||||
print()
|
||||
|
||||
|
||||
def ensure_sshpass():
|
||||
"""Проверяет наличие sshpass, при необходимости ставит через apt."""
|
||||
if exists("sshpass"):
|
||||
return True
|
||||
info("sshpass не найден. Устанавливаем ...")
|
||||
r1 = run("apt-get update", check=False, timeout=60)
|
||||
if r1.returncode != 0:
|
||||
warn(f"apt-get update не удался: {r1.stderr.strip()[:120]}")
|
||||
r = run("apt-get install -y sshpass", check=False, timeout=120)
|
||||
if r.returncode != 0:
|
||||
warn(f"Не удалось установить sshpass: {r.stderr.strip()[:120]}")
|
||||
return False
|
||||
return exists("sshpass")
|
||||
|
||||
|
||||
def pick_or_setup_ssh_key(host, user, port):
|
||||
"""
|
||||
Главная функция SSH-подготовки.
|
||||
|
||||
Reference in New Issue
Block a user