MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / sandbox_sync_down

Function sandbox_sync_down

crates/openshell-cli/src/ssh.rs:1136–1154  ·  view source on GitHub ↗

Pull a path from a sandbox to a local destination using tar-over-SSH. Follows `cp`-style semantics for the destination: - If the source is a single file: - When `dest` ends with `/` or already exists as a directory on the host, the file lands at ` / `. - Otherwise `dest` is taken to be the exact file path to write. - If the source is a directory, its contents are extracted i

(
    server: &str,
    name: &str,
    sandbox_path: &str,
    dest: &str,
    tls: &TlsOptions,
)

Source from the content-addressed store, hash-verified

1134/// before any SSH command is issued; paths that lexically resolve outside
1135/// `/sandbox` are refused.
1136pub async fn sandbox_sync_down(
1137 server: &str,
1138 name: &str,
1139 sandbox_path: &str,
1140 dest: &str,
1141 tls: &TlsOptions,
1142) -> Result<()> {
1143 let sandbox_path = validate_sandbox_source_path(sandbox_path)?;
1144 let session = ssh_session_config(server, name, tls).await?;
1145 let sandbox_path = resolve_sandbox_source_path(&session, &sandbox_path).await?;
1146 let kind = probe_sandbox_source_kind(&session, &sandbox_path).await?;
1147
1148 match kind {
1149 SandboxSourceKind::File => sandbox_sync_down_file(&session, &sandbox_path, dest).await,
1150 SandboxSourceKind::Directory => {
1151 sandbox_sync_down_directory(&session, &sandbox_path, dest).await
1152 }
1153 }
1154}
1155
1156/// Stream a tar archive from the sandbox and extract it into a fresh
1157/// destination directory. The source is always wrapped on the sandbox side so

Callers 2

mainFunction · 0.85
sandbox_sync_commandFunction · 0.85

Calls 6

ssh_session_configFunction · 0.85
sandbox_sync_down_fileFunction · 0.85

Tested by

no test coverage detected