fix: fix section adding and exception handling (#548)

Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
dw-0
2024-09-26 20:52:19 +02:00
committed by GitHub
parent afeb2bf02e
commit 4138c71920
10 changed files with 210 additions and 55 deletions

View File

@@ -48,6 +48,8 @@ def add_config_section(
scp.write_file(cfg_file)
Logger.print_ok("OK!")
def add_config_section_at_top(section: str, instances: List[InstanceType]) -> None:
# TODO: this could be implemented natively in SimpleConfigParser
@@ -69,6 +71,8 @@ def add_config_section_at_top(section: str, instances: List[InstanceType]) -> No
cfg_file.unlink()
tmp_cfg_path.rename(cfg_file)
Logger.print_ok("OK!")
def remove_config_section(section: str, instances: List[InstanceType]) -> None:
for instance in instances:
@@ -87,3 +91,5 @@ def remove_config_section(section: str, instances: List[InstanceType]) -> None:
scp.remove_section(section)
scp.write_file(cfg_file)
Logger.print_ok("OK!")