lifecycle config: add missing line in merge() and remove tracing

This commit is contained in:
Alex 2023-08-30 20:05:53 +02:00
parent 75ccc5a95c
commit d2e94e36d6
2 changed files with 2 additions and 12 deletions

View file

@ -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));
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))
}

View file

@ -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);
}
}