forked from Deuxfleurs/garage
db-snapshot: propagate any node snapshot error through RPC call
In particular, it means that "garage meta snapshot --all" will get an exit code of 1 if any node fails to snapshot. This makes sure that any external tool trying to snapshot nodes (e.g. from cron) will be aware of the failure. Fix #920
This commit is contained in:
parent
06aa4b604f
commit
a2e134f036
1 changed files with 5 additions and 1 deletions
|
@ -497,7 +497,11 @@ impl AdminRpcHandler {
|
||||||
ret.push(format!("{:?}\t{}", to, res_str));
|
ret.push(format!("{:?}\t{}", to, res_str));
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(AdminRpc::Ok(format_table_to_string(ret)))
|
if resps.iter().any(Result::is_err) {
|
||||||
|
Err(GarageError::Message(format_table_to_string(ret)).into())
|
||||||
|
} else {
|
||||||
|
Ok(AdminRpc::Ok(format_table_to_string(ret)))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
MetaOperation::Snapshot { all: false } => {
|
MetaOperation::Snapshot { all: false } => {
|
||||||
garage_model::snapshot::async_snapshot_metadata(&self.garage).await?;
|
garage_model::snapshot::async_snapshot_metadata(&self.garage).await?;
|
||||||
|
|
Loading…
Add table
Reference in a new issue