Add support for gpu-rent.vars and enhance git update functionality
- Updated .gitignore to include gpu-rent.vars. - Modified env.example to introduce the UPDATE_GIT variable for controlling git updates during execution. - Implemented Import-GpuRentVars function in gpu-rent.ps1 to load environment variables from gpu-rent.vars. - Enhanced gpu-rent.sh to support loading variables from gpu-rent.vars and added logic for handling default and extra arguments. - Updated CLI documentation to reflect the new gpu-rent.vars file and its usage in configuration. - Improved bootstrap and provisioning logic to conditionally perform git updates based on the new configuration.
This commit is contained in:
+23
-2
@@ -27,6 +27,27 @@ EXIT_STATUSES = frozenset(
|
||||
SHELVED_STATUSES = frozenset({"EXPIRED", "SHELVED", "SHELVED_OFFLOADED"})
|
||||
|
||||
|
||||
def _patch_paramiko_for_sshtunnel() -> None:
|
||||
"""sshtunnel 0.4 still refs paramiko.DSSKey; Paramiko 4+ removed it."""
|
||||
import paramiko
|
||||
|
||||
if hasattr(paramiko, "DSSKey"):
|
||||
return
|
||||
|
||||
class _DSSKeyRemoved(paramiko.PKey):
|
||||
def __init__(self, *args, **kwargs):
|
||||
raise paramiko.SSHException("DSA keys unsupported (paramiko>=4)")
|
||||
|
||||
paramiko.DSSKey = _DSSKeyRemoved # type: ignore[attr-defined, assignment]
|
||||
|
||||
|
||||
def _ssh_tunnel_forwarder():
|
||||
_patch_paramiko_for_sshtunnel()
|
||||
from sshtunnel import SSHTunnelForwarder
|
||||
|
||||
return SSHTunnelForwarder
|
||||
|
||||
|
||||
@dataclass
|
||||
class WatchDecision:
|
||||
kind: str # ok | reconnect | unshelve | exit
|
||||
@@ -51,7 +72,7 @@ def decide_watch(status: str | None, tunnel_alive: bool) -> WatchDecision:
|
||||
|
||||
|
||||
def _start_forwarder(cfg: Config, host: str, local_port: int):
|
||||
from sshtunnel import SSHTunnelForwarder
|
||||
SSHTunnelForwarder = _ssh_tunnel_forwarder()
|
||||
|
||||
server = SSHTunnelForwarder(
|
||||
(host, 22),
|
||||
@@ -131,7 +152,7 @@ def run_tunnel(
|
||||
poll_seconds: float = 30.0,
|
||||
) -> None:
|
||||
try:
|
||||
from sshtunnel import SSHTunnelForwarder # noqa: F401
|
||||
_ssh_tunnel_forwarder()
|
||||
except ImportError as exc:
|
||||
raise CloudError("Нет sshtunnel. Переустанови пакет: pip install -e .") from exc
|
||||
|
||||
|
||||
Reference in New Issue
Block a user