mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-21 23:03:35 +05:00
fix: update scp integration for more robust config handling (#535)
* chore: remove scp * Squashed 'kiauh/core/submodules/simple_config_parser/' content from commit abee21c git-subtree-dir: kiauh/core/submodules/simple_config_parser git-subtree-split: abee21c08658be4529028844304df60650c09afa * Squashed 'kiauh/core/submodules/simple_config_parser/' changes from abee21c..aa0302b aa0302b fix: fix missing newline chars in raw strings git-subtree-dir: kiauh/core/submodules/simple_config_parser git-subtree-split: aa0302b02b56b252ed88fd2db88ee878a5bb7b5b * Squashed 'kiauh/core/submodules/simple_config_parser/' changes from aa0302b..ef52958 ef52958 refactor: conditionally add empty line when adding new section git-subtree-dir: kiauh/core/submodules/simple_config_parser git-subtree-split: ef529580f469ef020135cb03e250fcd4e0d70acf * fix: update scp integration for more robust cfg modification Signed-off-by: Dominik Willner <th33xitus@gmail.com> --------- Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
@@ -122,10 +122,10 @@ class GcodeShellCmdExtension(BaseExtension):
|
||||
for cfg_file in cfg_files:
|
||||
Logger.print_status(f"Include shell_command.cfg in '{cfg_file}' ...")
|
||||
scp = SimpleConfigParser()
|
||||
scp.read(cfg_file)
|
||||
scp.read_file(cfg_file)
|
||||
if scp.has_section(section):
|
||||
Logger.print_info("Section already defined! Skipping ...")
|
||||
continue
|
||||
scp.add_section(section)
|
||||
scp.write(cfg_file)
|
||||
scp.write_file(cfg_file)
|
||||
Logger.print_ok("Done!")
|
||||
|
||||
@@ -141,5 +141,5 @@ class MoonrakerObico:
|
||||
return False
|
||||
|
||||
scp = SimpleConfigParser()
|
||||
scp.read(self.cfg_file)
|
||||
return scp.get("server", "auth_token", None) is not None
|
||||
scp.read_file(self.cfg_file)
|
||||
return scp.getval("server", "auth_token", None) is not None
|
||||
|
||||
@@ -281,15 +281,15 @@ class ObicoExtension(BaseExtension):
|
||||
|
||||
def _patch_obico_cfg(self, moonraker: Moonraker, obico: MoonrakerObico) -> None:
|
||||
scp = SimpleConfigParser()
|
||||
scp.read(obico.cfg_file)
|
||||
scp.set("server", "url", self.server_url)
|
||||
scp.set("moonraker", "port", str(moonraker.port))
|
||||
scp.set(
|
||||
scp.read_file(obico.cfg_file)
|
||||
scp.set_option("server", "url", self.server_url)
|
||||
scp.set_option("moonraker", "port", str(moonraker.port))
|
||||
scp.set_option(
|
||||
"logging",
|
||||
"path",
|
||||
obico.base.log_dir.joinpath(obico.log_file_name).as_posix(),
|
||||
)
|
||||
scp.write(obico.cfg_file)
|
||||
scp.write_file(obico.cfg_file)
|
||||
|
||||
def _patch_printer_cfg(self, klipper: List[Klipper]) -> None:
|
||||
add_config_section(
|
||||
|
||||
Reference in New Issue
Block a user