Add UNDEFINED versionins status

Signed-off-by: Andrey Berezin <a.berezin@yadro.com>
This commit is contained in:
Andrey Berezin 2023-08-04 14:19:49 +03:00
parent e4878f4d1e
commit d28f3cdc28
2 changed files with 4 additions and 0 deletions

View file

@ -15,6 +15,7 @@ def _make_objs_dict(key_names):
class VersioningStatus(HumanReadableEnum): class VersioningStatus(HumanReadableEnum):
UNDEFINED = None
ENABLED = "Enabled" ENABLED = "Enabled"
SUSPENDED = "Suspended" SUSPENDED = "Suspended"

View file

@ -67,6 +67,9 @@ def try_to_get_objects_and_expect_error(
@reporter.step_deco("Set versioning status to '{status}' for bucket '{bucket}'") @reporter.step_deco("Set versioning status to '{status}' for bucket '{bucket}'")
def set_bucket_versioning(s3_client: S3ClientWrapper, bucket: str, status: VersioningStatus): def set_bucket_versioning(s3_client: S3ClientWrapper, bucket: str, status: VersioningStatus):
if status == VersioningStatus.UNDEFINED:
return
s3_client.get_bucket_versioning_status(bucket) s3_client.get_bucket_versioning_status(bucket)
s3_client.put_bucket_versioning(bucket, status=status) s3_client.put_bucket_versioning(bucket, status=status)
bucket_status = s3_client.get_bucket_versioning_status(bucket) bucket_status = s3_client.get_bucket_versioning_status(bucket)