diff --git a/rustfs/src/storage/ecfs.rs b/rustfs/src/storage/ecfs.rs index be4100b3..de863b78 100644 --- a/rustfs/src/storage/ecfs.rs +++ b/rustfs/src/storage/ecfs.rs @@ -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() })) }