forked from TrueCloudLab/frostfs-testlib
16 lines
597 B
Python
16 lines
597 B
Python
import re
|
|
|
|
from frostfs_testlib.cli.generic_cli import GenericCli
|
|
from frostfs_testlib.s3.interfaces import BucketContainerResolver
|
|
from frostfs_testlib.storage.cluster import ClusterNode
|
|
|
|
|
|
class CurlBucketContainerResolver(BucketContainerResolver):
|
|
def resolve(self, node: ClusterNode, bucket_name: str, **kwargs: dict) -> str:
|
|
curl = GenericCli("curl", node.host)
|
|
output = curl(f"-I http://127.0.0.1:8084/{bucket_name}")
|
|
pattern = r"X-Container-Id: (\S+)"
|
|
cid = re.findall(pattern, output.stdout)
|
|
if cid:
|
|
return cid[0]
|
|
return None
|