mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-24 00:03:42 +05:00
fix(moonraker): patch klippy_uds_address section when converting single to multi instance
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
@@ -35,12 +35,17 @@ class Moonraker(BaseInstance):
|
|||||||
self.backup_dir = self.data_dir.joinpath("backup")
|
self.backup_dir = self.data_dir.joinpath("backup")
|
||||||
self.certs_dir = self.data_dir.joinpath("certs")
|
self.certs_dir = self.data_dir.joinpath("certs")
|
||||||
self._db_dir = self.data_dir.joinpath("database")
|
self._db_dir = self.data_dir.joinpath("database")
|
||||||
|
self._comms_dir = self.data_dir.joinpath("comms")
|
||||||
self.log = self.log_dir.joinpath("moonraker.log")
|
self.log = self.log_dir.joinpath("moonraker.log")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def db_dir(self) -> Path:
|
def db_dir(self) -> Path:
|
||||||
return self._db_dir
|
return self._db_dir
|
||||||
|
|
||||||
|
@property
|
||||||
|
def comms_dir(self) -> Path:
|
||||||
|
return self._comms_dir
|
||||||
|
|
||||||
def create(self, create_example_cfg: bool = False) -> None:
|
def create(self, create_example_cfg: bool = False) -> None:
|
||||||
Logger.print_status("Creating new Moonraker Instance ...")
|
Logger.print_status("Creating new Moonraker Instance ...")
|
||||||
service_template_path = MODULE_PATH.joinpath("assets/moonraker.service")
|
service_template_path = MODULE_PATH.joinpath("assets/moonraker.service")
|
||||||
|
|||||||
@@ -150,13 +150,27 @@ def moonraker_to_multi_conversion(new_name: str) -> None:
|
|||||||
return
|
return
|
||||||
|
|
||||||
Logger.print_status("Convert Moonraker single to multi instance ...")
|
Logger.print_status("Convert Moonraker single to multi instance ...")
|
||||||
|
|
||||||
# remove the old single instance
|
# remove the old single instance
|
||||||
im.current_instance = im.instances[0]
|
im.current_instance = im.instances[0]
|
||||||
im.stop_instance()
|
im.stop_instance()
|
||||||
im.disable_instance()
|
im.disable_instance()
|
||||||
im.delete_instance()
|
im.delete_instance()
|
||||||
# create a new klipper instance with the new name
|
|
||||||
im.current_instance = Moonraker(suffix=new_name)
|
# create a new moonraker instance with the new name
|
||||||
|
new_instance = Moonraker(suffix=new_name)
|
||||||
|
im.current_instance = new_instance
|
||||||
|
|
||||||
|
# patch the server sections klippy_uds_address value to match the new printer_data foldername
|
||||||
|
cm = ConfigManager(new_instance.cfg_file)
|
||||||
|
if cm.config.has_section("server"):
|
||||||
|
cm.set_value(
|
||||||
|
"server",
|
||||||
|
"klippy_uds_address",
|
||||||
|
str(new_instance.comms_dir.joinpath("klippy.sock")),
|
||||||
|
)
|
||||||
|
cm.write_config()
|
||||||
|
|
||||||
# create, enable and start the new moonraker instance
|
# create, enable and start the new moonraker instance
|
||||||
im.create_instance()
|
im.create_instance()
|
||||||
im.enable_instance()
|
im.enable_instance()
|
||||||
|
|||||||
Reference in New Issue
Block a user