mirror of
https://github.com/rustfs/rustfs.git
synced 2026-01-17 01:30:33 +00:00
fix(lifecycle): Return NoSuchLifecycleConfiguration error for missing lifecycle config (#1087)
Co-authored-by: loverustfs <hello@rustfs.com>
This commit is contained in:
@@ -4518,18 +4518,16 @@ impl S3 for FS {
|
||||
.map_err(ApiError::from)?;
|
||||
|
||||
let rules = match metadata_sys::get_lifecycle_config(&bucket).await {
|
||||
Ok((cfg, _)) => Some(cfg.rules),
|
||||
Ok((cfg, _)) => cfg.rules,
|
||||
Err(_err) => {
|
||||
// if BucketMetadataError::BucketLifecycleNotFound.is(&err) {
|
||||
// return Err(s3_error!(NoSuchLifecycleConfiguration));
|
||||
// }
|
||||
// warn!("get_lifecycle_config err {:?}", err);
|
||||
None
|
||||
// Return NoSuchLifecycleConfiguration error as expected by S3 clients
|
||||
// This fixes issue #990 where Ansible S3 roles fail with KeyError: 'Rules'
|
||||
return Err(s3_error!(NoSuchLifecycleConfiguration));
|
||||
}
|
||||
};
|
||||
|
||||
Ok(S3Response::new(GetBucketLifecycleConfigurationOutput {
|
||||
rules,
|
||||
rules: Some(rules),
|
||||
..Default::default()
|
||||
}))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user