forked from TrueCloudLab/frostfs-testcases
24 lines
650 B
Python
24 lines
650 B
Python
|
from dataclasses import dataclass
|
||
|
|
||
|
from frostfs_testlib.steps.cli.container import DEFAULT_PLACEMENT_RULE
|
||
|
from frostfs_testlib.storage.cluster import Cluster
|
||
|
|
||
|
|
||
|
@dataclass
|
||
|
class ContainerSpec:
|
||
|
rule: str = DEFAULT_PLACEMENT_RULE
|
||
|
basic_acl: str = None
|
||
|
allow_owner_via_ape: bool = False
|
||
|
|
||
|
def parsed_rule(self, cluster: Cluster):
|
||
|
if self.rule is None:
|
||
|
return None
|
||
|
|
||
|
substitutions = {"%NODE_COUNT%": str(len(cluster.cluster_nodes))}
|
||
|
|
||
|
parsed_rule = self.rule
|
||
|
for sub, replacement in substitutions.items():
|
||
|
parsed_rule = parsed_rule.replace(sub, replacement)
|
||
|
|
||
|
return parsed_rule
|