dw-0 / kiauh

Klipper Installation And Update Helper
GNU General Public License v3.0
3.26k stars 472 forks source link

v6.0.0-alpha.2: [ERROR] An unexpected error occured: Section 'include mainsail.cfg' is defined more than once #521

Open the-simian opened 1 week ago

the-simian commented 1 week ago

Linux Distribution

Pi4 running bookworm

Linux version 6.6.47+rpt-rpi-2712 (serge@raspberrypi.com) (gcc-12 (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) # 1 SMP PREEMPT Debian 1:6.6.47-1+rpt1 (2024-09-02)

What happened

After selecting to remove Mainsail I got the following trace:

###### Removing Mainsail ...
[INFO] File '/home/pi/mainsail' does not exist. Skipped ...

###### Removing NGINX config for Mainsail ...

###### Removing NGINX logs for Mainsail ...
[INFO] File '/home/pi/printer_data/logs/mainsail-access.log' does not exist. Skipped ...
[INFO] File '/home/pi/printer_data/logs/mainsail-error.log' does not exist. Skipped ...

###### Remove section '[update_manager mainsail]' from '/home/pi/printer_data/config/moonraker.conf' ...
[INFO] Section does not exist. Skipped ...

###### Removing Mainsail-Config ...
[INFO] File '/home/pi/mainsail-config' does not exist. Skipped ...
[INFO] File '/home/pi/printer_data/config/mainsail.cfg' does not exist. Skipped ...

###### Remove section '[update_manager mainsail-config]' from '/home/pi/printer_data/config/moonraker.conf' ...
[INFO] Section does not exist. Skipped ...

###### Remove section '[include mainsail.cfg]' from '/home/pi/printer_data/config/printer.cfg' ...
[ERROR] An unexpected error occured:
Section 'include mainsail.cfg' is defined more than once
Traceback (most recent call last):
  File "/home/pi/kiauh/kiauh/core/menus/base_menu.py", line 188, in run
    selected_option.method(
  File "/home/pi/kiauh/kiauh/components/webui_client/menus/client_remove_menu.py", line 106, in run_removal_process
    client_remove.run_client_removal(
  File "/home/pi/kiauh/kiauh/components/webui_client/client_remove.py", line 53, in run_client_removal
    run_client_config_removal(
  File "/home/pi/kiauh/kiauh/components/webui_client/client_config/client_config_remove.py", line 30, in run_client_config_removal
    remove_config_section(client_config.config_section, kl_instances)
  File "/home/pi/kiauh/kiauh/utils/config_utils.py", line 83, in remove_config_section
    scp.read(cfg_file)
  File "/home/pi/kiauh/kiauh/core/submodules/simple_config_parser/src/simple_config_parser/simple_config_parser.py", line 160, in read
    self._parse_config(f.readlines())
  File "/home/pi/kiauh/kiauh/core/submodules/simple_config_parser/src/simple_config_parser/simple_config_parser.py", line 453, in _parse_config
    self._parse_section(line)
  File "/home/pi/kiauh/kiauh/core/submodules/simple_config_parser/src/simple_config_parser/simple_config_parser.py", line 482, in _parse_section
    self._store_internal_state_section(section_name, line)
  File "/home/pi/kiauh/kiauh/core/submodules/simple_config_parser/src/simple_config_parser/simple_config_parser.py", line 488, in _store_internal_state_section
    raise DuplicateSectionError(section)
core.submodules.simple_config_parser.src.simple_config_parser.simple_config_parser.DuplicateSectionError: Section 'include mainsail.cfg' is defined more than once

What did you expect to happen

I expected a clean uninstall of Mainsail.

How to reproduce

In my case this occured when using the latest version, v6 of kiauh I installed mainsail, then attempted to remove it right afterwards

When removing the mainsail install, I got the trace I posted in the What happened section.

Additional information

Ultimately, this was being removed in order to try and move Mainsail to another port besides port 80. I am currently already running pihole's web interface on 80, and I would rather move Mainsail to an alternative port than pihole. I couldn't 'force' the port selection to appear in the install menu (possibly a user error, this is my first time using this). I edited the port number in default.kiauh.cfg and was trying to reinstall to see if this would move it.

Let me know if there's anything else I can provide in terms of information.

the-simian commented 1 week ago

I want to add that editing the port in the default.kiauh.cfg and reinstalling did achieve my goal. Despite the error message it looks like the program did actually uninstall, and then reinstall correctly; it is currently working and running on the correct (alternative) port number.

This thrown error doesn't seem to have caused any real issue for me. I still wanted to log it here just in case.

thanks for this great repo!