Add metabase and write_cache operations

Signed-off-by: Andrey Berezin <a.berezin@yadro.com>
This commit is contained in:
Andrey Berezin 2023-05-30 16:32:38 +03:00
parent a26f8e9c80
commit 2bad0f1db6
10 changed files with 152 additions and 14 deletions

View file

@ -73,6 +73,21 @@ class ClusterNode:
def s3_gate(self) -> S3Gate:
return self.service(S3Gate)
def get_config(self, config_file_path: str) -> dict:
shell = self.host.get_shell()
result = shell.exec(f"cat {config_file_path}")
config_text = result.stdout
config = yaml.safe_load(config_text)
return config
def save_config(self, new_config: dict, config_file_path: str) -> None:
shell = self.host.get_shell()
config_str = yaml.dump(new_config)
shell.exec(f"echo '{config_str}' | sudo tee {config_file_path}")
def service(self, service_type: type[ServiceClass]) -> ServiceClass:
"""
Get a service cluster node of specified type.