From d2e94e36d64d4062ebe1fabac65ac1a6f265de17 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Wed, 30 Aug 2023 20:05:53 +0200 Subject: lifecycle config: add missing line in merge() and remove tracing --- src/api/s3/lifecycle.rs | 13 +------------ src/model/bucket_table.rs | 1 + 2 files changed, 2 insertions(+), 12 deletions(-) (limited to 'src') 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, 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(" must contain either or "), (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); } } -- cgit v1.2.3