aboutsummaryrefslogtreecommitdiff
path: root/src/api/admin/bucket.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-05-13 19:36:17 +0200
committerAlex Auvolat <alex@adnab.me>2022-05-13 19:36:17 +0200
commit8033bdb0b4577133cff7d4d90a811ed8f3e13365 (patch)
tree5f4abf43f18322c64db68787d91a227aa4421b97 /src/api/admin/bucket.rs
parent5a535788fc0a69950bbfdc6f189597c5e37a6e3b (diff)
downloadgarage-8033bdb0b4577133cff7d4d90a811ed8f3e13365.tar.gz
garage-8033bdb0b4577133cff7d4d90a811ed8f3e13365.zip
More precisions in errors & small refactoring
Diffstat (limited to 'src/api/admin/bucket.rs')
-rw-r--r--src/api/admin/bucket.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/api/admin/bucket.rs b/src/api/admin/bucket.rs
index c5518e4e..00450319 100644
--- a/src/api/admin/bucket.rs
+++ b/src/api/admin/bucket.rs
@@ -248,11 +248,10 @@ pub async fn handle_create_bucket(
}
let key = garage
- .key_table
- .get(&EmptyKey, &la.access_key_id)
- .await?
- .ok_or(Error::NoSuchAccessKey)?;
- let state = key.state.as_option().ok_or(Error::NoSuchAccessKey)?;
+ .key_helper()
+ .get_existing_key(&la.access_key_id)
+ .await?;
+ let state = key.state.as_option().unwrap();
if matches!(state.local_aliases.get(&la.alias), Some(_)) {
return Err(Error::bad_request("Local alias already exists"));
}