forked from TrueCloudLab/frostfs-testlib
[#183] Read all configuration files for service config
Signed-off-by: Andrey Berezin <a.berezin@yadro.com>
This commit is contained in:
parent
751381cd60
commit
55cebc042c
5 changed files with 68 additions and 52 deletions
|
@ -127,25 +127,23 @@ class StorageNode(NodeBase):
|
|||
output = self.host.get_shell().exec(f"curl -s localhost:6672 | grep {health_metric} | sed 1,2d").stdout
|
||||
return health_metric in output
|
||||
|
||||
# TODO: Deprecated. Use new approach with config
|
||||
def get_shard_config_path(self) -> str:
|
||||
return self._get_attribute(ConfigAttributes.SHARD_CONFIG_PATH)
|
||||
|
||||
# TODO: Deprecated. Use new approach with config
|
||||
def get_shards_config(self) -> tuple[str, dict]:
|
||||
return self.get_config(self.get_shard_config_path())
|
||||
|
||||
def get_shards(self) -> list[Shard]:
|
||||
config = self.get_shards_config()[1]
|
||||
config["storage"]["shard"].pop("default")
|
||||
return [Shard.from_object(shard) for shard in config["storage"]["shard"].values()]
|
||||
shards = self.config.get("storage:shard")
|
||||
|
||||
def get_shards_from_env(self) -> list[Shard]:
|
||||
config = self.get_shards_config()[1]
|
||||
configObj = ConfigObj(StringIO(config))
|
||||
if not shards:
|
||||
raise RuntimeError(f"Cannot get shards information for {self.name} on {self.host.config.address}")
|
||||
|
||||
pattern = f"{SHARD_PREFIX}\d*"
|
||||
num_shards = len(set(re.findall(pattern, self.get_shards_config())))
|
||||
|
||||
return [Shard.from_config_object(configObj, shard_id) for shard_id in range(num_shards)]
|
||||
if "default" in shards:
|
||||
shards.pop("default")
|
||||
return [Shard.from_object(shard) for shard in shards.values()]
|
||||
|
||||
def get_control_endpoint(self) -> str:
|
||||
return self._get_attribute(ConfigAttributes.CONTROL_ENDPOINT)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue