exlab_wizard.sync.transports.rsync_ssh#
rsync-over-SSH transport driver. Backend Spec §7.1.3.
Shells out to rsync -avz --checksum --partial -e "ssh -i <key> -o
BatchMode=yes" --bwlimit=<K> <local> <user>@<host>:<path>. SSH
authentication is key-based only; the spec rejects password auth at
config-validation time (see exlab_wizard.config.models.RsyncSshTransport).
The driver is intentionally thin: it calls the binary, captures stdout /
stderr, and translates the exit-code + stderr-substring into one of the
TransportErrorKind retry classes. Hash verification is the
exlab_wizard.sync.verifier module’s responsibility, NOT this
driver’s.
Classes
|
rsync-over-SSH transport driver. |
- class exlab_wizard.sync.transports.rsync_ssh.RsyncSshTransport(*, binary='rsync')[source]#
Bases:
objectrsync-over-SSH transport driver. Backend Spec §7.1.3.
- Parameters:
binary (
str)
- async hashsum(ssh_target, ssh_key_path, remote_path)[source]#
Probe
remote_pathviassh ... find ... sha256sumand parse.Returns a
{relative-path: sha256-hex}dict whose keys are stripped of theremote_pathprefix so they match the local manifest’s relative-path convention (seeexlab_wizard.sync.verifier.Verifier.compute_local_manifest()) on success (rc == 0). The dict may legitimately be empty if the remote subtree contains no files.Failure modes are surfaced as
TransportErrorwith the classifiederror_kindso the caller (the verifier / queue worker) can route via the spec-correct §7.1.5 retry path:AUTH– terminal FAILED.NETWORK/UNKNOWN– backoff retry.
Spawn failure (binary missing) also raises
TransportErrorbut witherror_kind=Noneso the worker treats it as a non-terminal failure (operator can install ssh and the job will retry rather than terminating).
- async push(local, ssh_target, ssh_key_path, remote_path, *, bwlimit_kibps=None)[source]#
Run
rsync -avz --checksumfromlocaltossh_target:remote_path.ssh_targetis<user>@<host>.ssh_key_pathis forwarded via-e 'ssh -i <key> -o BatchMode=yes'so the driver never prompts for a password.Returns a
TransportResult. RaisesTransportErrorwhen the rsync binary is missing (no retry will help).