import logging import re from frostfs_testlib import reporter logger = logging.getLogger("NeoLogger") @reporter.step("Read environment.properties") def read_env_properties(file_path: str) -> dict: with open(file_path, "r") as file: raw_content = file.read() env_properties = {} for line in raw_content.split("\n"): m = re.match("(.*?)=(.*)", line) if not m: logger.warning(f"Could not parse env property from {line}") continue key, value = m.group(1), m.group(2) env_properties[key] = value return env_properties @reporter.step("Update data in environment.properties") def save_env_properties(file_path: str, env_data: dict) -> None: with open(file_path, "a+") as env_file: for env, env_value in env_data.items(): env_file.write(f"{env}={env_value}\n")