Skip to content

NSFS | S3 | Versioning: HeadObject on tagged object in version-enabled bucket does not return x-amz-tagging-count #8353

@hseipp

Description

@hseipp

Environment info

Actual behavior

When performing a HeadObject operation on an object with multiple versions that got tagged (without versionId), there is no x-amz-tagging-count entry in the HTTP response headers:

        response = client.head_object(Bucket=bucket_name, Key=key)
        assert response['ResponseMetadata']['HTTPStatusCode'] == 200
>       assert response['ResponseMetadata']['HTTPHeaders']['x-amz-tagging-count'] == str(count)
E       KeyError: 'x-amz-tagging-count'

Expected behavior

The HeadObject HTTP response header returns x-amz-tagging-count with a value of 1.

Steps to reproduce

Execute the following extension code for Ceph s3-tests:

    @pytest.mark.versioning
    def test_s3cever12():
        client = get_client()
        bucket_name = get_new_bucket(client=client)
    
        # The following operation uses another client instance -> following operations will fail
    #    check_configure_versioning_retry(bucket_name, "Enabled", "Enabled")
        _ces_safe_check_configure_versioning_retry(client, bucket_name, "Enabled", "Enabled")
    
        key = "test"
        version_ids = []
        contents = []
        num_versions = 3
        (version_ids, contents) = create_multiple_versions(client, bucket_name, key, num_versions)
    
        response = client.list_object_versions(Bucket=bucket_name)
        assert len(response['Versions']) == 3
    
        count = 1
        tagset = _create_simple_tagset(count)
        client.put_object_tagging(Bucket=bucket_name, Key=key, Tagging=tagset)
    
        response = client.head_object(Bucket=bucket_name, Key=key)
        print(response)
        assert response['ResponseMetadata']['HTTPStatusCode'] == 200
        assert response['ResponseMetadata']['HTTPHeaders']['x-amz-tagging-count'] == str(count)

More information - Screenshots / Logs / Other output

Complete response metadata:

{'ResponseMetadata': {'RequestId': 'm0xz10l6-42drw2-7nf', 'HostId': 'm0xz10l6-42drw2-7nf', 'HTTPStatusCode': 200, 'HTTPHeaders': {'x-amz-request-id': 'm0xz10l6-42drw2-7nf', 'x-amz-id-2': 'm0xz10l6-42drw2-7nf', 'access-control-allow-origin': '*', 'access-control-allow-credentials': 'true', 'access-control-allow-methods': 'GET,POST,PUT,DELETE,OPTIONS', 'access-control-allow-headers': 'Content-Type,Content-MD5,Authorization,X-Amz-User-Agent,X-Amz-Date,ETag,X-Amz-Content-Sha256,amz-sdk-invocation-id,amz-sdk-request', 'access-control-expose-headers': 'ETag,X-Amz-Version-Id', 'etag': '"mtime-d43j9qlyz9j4-ino-f0j"', 'last-modified': 'Wed, 11 Sep 2024 14:43:47 GMT', 'content-type': 'application/octet-stream', 'content-length': '9', 'accept-ranges': 'bytes', 'x-amz-version-id': 'mtime-d43j9qlyz9j4-ino-f0j', 'date': 'Wed, 11 Sep 2024 14:43:47 GMT', 'connection': 'keep-alive', 'keep-alive': 'timeout=5'}, 'RetryAttempts': 0}, 'AcceptRanges': 'bytes', 'LastModified': datetime.datetime(2024, 9, 11, 14, 43, 47, tzinfo=tzutc()), 'ContentLength': 9, 'ETag': '"mtime-d43j9qlyz9j4-ino-f0j"', 'VersionId': 'mtime-d43j9qlyz9j4-ino-f0j', 'ContentType': 'application/octet-stream', 'Metadata': {}}

Logs with "all" log level:
noobaa_20240911_3.log.gz

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions