chore: rustfmt the workspace and make clippy -D warnings pass
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -211,15 +211,10 @@ async fn beam_restic(repository: &str, hub: &str, token: &str, orbit_id: uuid::U
|
||||
let registered = reply["snapshot_id"]
|
||||
.as_str()
|
||||
.context("hub did not register the Restic snapshot")?;
|
||||
info!(
|
||||
snapshot,
|
||||
registered,
|
||||
"committed Restic backup"
|
||||
);
|
||||
info!(snapshot, registered, "committed Restic backup");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
fn restic_command(repository: &str) -> Result<tokio::process::Command> {
|
||||
let authority = repository
|
||||
.strip_prefix("rest:https://")
|
||||
@@ -229,7 +224,8 @@ fn restic_command(repository: &str) -> Result<tokio::process::Command> {
|
||||
"TESSERA_RESTIC_REPOSITORY must be a rest:https:// URL without embedded credentials"
|
||||
);
|
||||
let mut command = tokio::process::Command::new("restic");
|
||||
command.env("RESTIC_REPOSITORY", repository)
|
||||
command
|
||||
.env("RESTIC_REPOSITORY", repository)
|
||||
.env_remove("RESTIC_REPOSITORY_FILE")
|
||||
.stdin(std::process::Stdio::null())
|
||||
.kill_on_drop(true);
|
||||
@@ -237,13 +233,23 @@ fn restic_command(repository: &str) -> Result<tokio::process::Command> {
|
||||
}
|
||||
|
||||
async fn restic_snapshot(mut command: tokio::process::Command) -> Result<String> {
|
||||
let output = command.output().await.context("starting restic (install restic on PATH)")?;
|
||||
anyhow::ensure!(output.status.success(), "restic backup failed ({})", output.status);
|
||||
let output = command
|
||||
.output()
|
||||
.await
|
||||
.context("starting restic (install restic on PATH)")?;
|
||||
anyhow::ensure!(
|
||||
output.status.success(),
|
||||
"restic backup failed ({})",
|
||||
output.status
|
||||
);
|
||||
let summary: serde_json::Value = serde_json::from_str(
|
||||
std::str::from_utf8(&output.stdout)?
|
||||
.lines()
|
||||
.last()
|
||||
.context("missing restic summary")?,
|
||||
)?;
|
||||
Ok(summary["snapshot_id"].as_str().context("missing restic snapshot ID")?.to_owned())
|
||||
Ok(summary["snapshot_id"]
|
||||
.as_str()
|
||||
.context("missing restic snapshot ID")?
|
||||
.to_owned())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user