aboutsummaryrefslogtreecommitdiff
path: root/src/garage
diff options
context:
space:
mode:
authorQuentin <quentin@deuxfleurs.fr>2020-11-19 14:39:30 +0100
committerQuentin <quentin@deuxfleurs.fr>2020-11-19 14:39:30 +0100
commitfc427b0b66241785ecd3fe23ec3e4ac72aaed1da (patch)
treeea406de04a7a11c09c6d758ca97ba53fc2bdfbe4 /src/garage
parent6076d869b14aa38059d54a2dece222ad7b9da3bc (diff)
parent044d7988779aadac9290b58ceb077c1211670aed (diff)
downloadgarage-fc427b0b66241785ecd3fe23ec3e4ac72aaed1da.tar.gz
garage-fc427b0b66241785ecd3fe23ec3e4ac72aaed1da.zip
Merge branch 'master' into feature/website
Diffstat (limited to 'src/garage')
-rw-r--r--src/garage/admin_rpc.rs19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/garage/admin_rpc.rs b/src/garage/admin_rpc.rs
index 1dd118ac..b29f2f77 100644
--- a/src/garage/admin_rpc.rs
+++ b/src/garage/admin_rpc.rs
@@ -55,7 +55,7 @@ impl AdminRpcHandler {
AdminRPC::BucketOperation(bo) => self2.handle_bucket_cmd(bo).await,
AdminRPC::KeyOperation(ko) => self2.handle_key_cmd(ko).await,
AdminRPC::LaunchRepair(opt) => self2.handle_launch_repair(opt).await,
- _ => Err(Error::BadRequest(format!("Invalid RPC"))),
+ _ => Err(Error::BadRPC(format!("Invalid RPC"))),
}
}
});
@@ -81,7 +81,7 @@ impl AdminRpcHandler {
BucketOperation::Create(query) => {
let bucket = self.garage.bucket_table.get(&EmptyKey, &query.name).await?;
if bucket.as_ref().filter(|b| !b.deleted).is_some() {
- return Err(Error::BadRequest(format!(
+ return Err(Error::BadRPC(format!(
"Bucket {} already exists",
query.name
)));
@@ -104,13 +104,10 @@ impl AdminRpcHandler {
.get_range(&query.name, None, Some(()), 10)
.await?;
if !objects.is_empty() {
- return Err(Error::BadRequest(format!(
- "Bucket {} is not empty",
- query.name
- )));
+ return Err(Error::BadRPC(format!("Bucket {} is not empty", query.name)));
}
if !query.yes {
- return Err(Error::BadRequest(format!(
+ return Err(Error::BadRPC(format!(
"Add --yes flag to really perform this operation"
)));
}
@@ -199,7 +196,7 @@ impl AdminRpcHandler {
KeyOperation::Delete(query) => {
let key = self.get_existing_key(&query.key_id).await?;
if !query.yes {
- return Err(Error::BadRequest(format!(
+ return Err(Error::BadRPC(format!(
"Add --yes flag to really perform this operation"
)));
}
@@ -233,7 +230,7 @@ impl AdminRpcHandler {
.await?
.filter(|b| !b.deleted)
.map(Ok)
- .unwrap_or(Err(Error::BadRequest(format!(
+ .unwrap_or(Err(Error::BadRPC(format!(
"Bucket {} does not exist",
bucket
))))
@@ -246,7 +243,7 @@ impl AdminRpcHandler {
.await?
.filter(|k| !k.deleted)
.map(Ok)
- .unwrap_or(Err(Error::BadRequest(format!("Key {} does not exist", id))))
+ .unwrap_or(Err(Error::BadRPC(format!("Key {} does not exist", id))))
}
async fn update_bucket_key(
@@ -306,7 +303,7 @@ impl AdminRpcHandler {
async fn handle_launch_repair(self: &Arc<Self>, opt: RepairOpt) -> Result<AdminRPC, Error> {
if !opt.yes {
- return Err(Error::BadRequest(format!(
+ return Err(Error::BadRPC(format!(
"Please provide the --yes flag to initiate repair operations."
)));
}