aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-08-30 20:05:53 +0200
committerAlex Auvolat <alex@adnab.me>2023-08-30 20:05:53 +0200
commitd2e94e36d64d4062ebe1fabac65ac1a6f265de17 (patch)
tree0e7aac36371ae688ed97a53b89a7da4c361b58ae
parent75ccc5a95c76f31235fcaab8a2c1795693733a4b (diff)
downloadgarage-d2e94e36d64d4062ebe1fabac65ac1a6f265de17.tar.gz
garage-d2e94e36d64d4062ebe1fabac65ac1a6f265de17.zip
lifecycle config: add missing line in merge() and remove tracing
-rw-r--r--src/api/s3/lifecycle.rs13
-rw-r--r--src/model/bucket_table.rs1
2 files changed, 2 insertions, 12 deletions
diff --git a/src/api/s3/lifecycle.rs b/src/api/s3/lifecycle.rs
index f0fde083..9036f84c 100644
--- a/src/api/s3/lifecycle.rs
+++ b/src/api/s3/lifecycle.rs
@@ -21,8 +21,6 @@ pub async fn handle_get_lifecycle(bucket: &Bucket) -> Result<Response<Body>, Err
.params()
.ok_or_internal_error("Bucket should not be deleted at this point")?;
- trace!("bucket: {:#?}", bucket);
-
if let Some(lifecycle) = param.lifecycle_config.get() {
let wc = LifecycleConfiguration::from_garage_lifecycle_config(lifecycle);
let xml = to_xml_with_header(&wc)?;
@@ -76,20 +74,12 @@ pub async fn handle_put_lifecycle(
let param = bucket.params_mut().unwrap();
let conf: LifecycleConfiguration = from_reader(&body as &[u8])?;
-
let config = conf
.validate_into_garage_lifecycle_config()
.ok_or_bad_request("Invalid lifecycle configuration")?;
- param.lifecycle_config.update(Some(config));
+ param.lifecycle_config.update(Some(config));
garage.bucket_table.insert(&bucket).await?;
- trace!("new bucket: {:#?}", bucket);
-
- let bucket = garage
- .bucket_helper()
- .get_existing_bucket(bucket_id)
- .await?;
- trace!("new bucket again: {:#?}", bucket);
Ok(Response::builder()
.status(StatusCode::OK)
@@ -281,7 +271,6 @@ impl Expiration {
(None, None) => Err("<Expiration> must contain either <Days> or <Date>"),
(Some(days), None) => Ok(GarageLifecycleExpiration::AfterDays(days.0 as usize)),
(None, Some(date)) => {
- trace!("date: {}", date.0);
parse_lifecycle_date(&date.0)?;
Ok(GarageLifecycleExpiration::AtDate(date.0))
}
diff --git a/src/model/bucket_table.rs b/src/model/bucket_table.rs
index df2e9b4a..0eefa0e5 100644
--- a/src/model/bucket_table.rs
+++ b/src/model/bucket_table.rs
@@ -151,6 +151,7 @@ impl Crdt for BucketParams {
self.website_config.merge(&o.website_config);
self.cors_config.merge(&o.cors_config);
+ self.lifecycle_config.merge(&o.lifecycle_config);
self.quotas.merge(&o.quotas);
}
}