Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate Moonraker conf on save #318

Open
leigh-johnson opened this issue Jul 5, 2023 · 2 comments
Open

Validate Moonraker conf on save #318

leigh-johnson opened this issue Jul 5, 2023 · 2 comments
Assignees
Labels
Milestone

Comments

@leigh-johnson
Copy link
Member

Describe the bug

I'm seeing reports that Moonraker crashes when using the default moonraker.conf https://github.com/bitsy-ai/printnanny-settings/blob/4fe6928b8864cd5b578356539b5d7b7395785d06/moonraker/moonraker.conf

Jun 30 20:51:06 x10m-0000 bash[678]: [utils.py:setup_logging()] - data_path: /home/printnanny/.local/share/moonraker
Jun 30 20:51:06 x10m-0000 bash[678]: [utils.py:setup_logging()] - is_default_data_path: False
Jun 30 20:51:06 x10m-0000 bash[678]: [utils.py:setup_logging()] - config_file: /home/printnanny/.config/printnanny/vcs/moonraker/moonraker.conf
Jun 30 20:51:06 x10m-0000 bash[678]: [utils.py:setup_logging()] - startup_warnings: []
Jun 30 20:51:06 x10m-0000 bash[678]: [utils.py:setup_logging()] - verbose: False
Jun 30 20:51:06 x10m-0000 bash[678]: [utils.py:setup_logging()] - debug: False
Jun 30 20:51:06 x10m-0000 bash[678]: [utils.py:setup_logging()] - asyncio_debug: False
Jun 30 20:51:06 x10m-0000 bash[678]: [utils.py:setup_logging()] - is_backup_config: False
Jun 30 20:51:06 x10m-0000 bash[678]: [utils.py:setup_logging()] - log_file: /var/log/moonraker/moonraker.log
Jun 30 20:51:06 x10m-0000 bash[678]: [utils.py:setup_logging()] - software_version: ?
Jun 30 20:51:06 x10m-0000 bash[678]: [utils.py:setup_logging()] - python_version: 3.11.2 (main, Feb  7 2023, 13:52:42) [GCC 12.2.0]
Jun 30 20:51:06 x10m-0000 bash[678]: [confighelper.py:read_file()] - Configuration File '/home/printnanny/.config/printnanny/vcs/moonraker/moonraker.conf' parsed, total size: 0 B
Jun 30 20:51:06 x10m-0000 bash[678]: [moonraker.py:main()] - Server Config Error
Jun 30 20:51:06 x10m-0000 bash[678]: Traceback (most recent call last):
Jun 30 20:51:06 x10m-0000 bash[678]:   File "/home/printnanny/.moonraker/moonraker/moonraker.py", line 497, in main
Jun 30 20:51:06 x10m-0000 bash[678]:     server = Server(app_args, file_logger, event_loop)
Jun 30 20:51:06 x10m-0000 bash[678]:              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jun 30 20:51:06 x10m-0000 bash[678]:   File "/home/printnanny/.moonraker/moonraker/moonraker.py", line 72, in __init__
Jun 30 20:51:06 x10m-0000 bash[678]:     self.config = config = self._parse_config()
Jun 30 20:51:06 x10m-0000 bash[678]:                            ^^^^^^^^^^^^^^^^^^^^
Jun 30 20:51:06 x10m-0000 bash[678]:   File "/home/printnanny/.moonraker/moonraker/moonraker.py", line 133, in _parse_config
Jun 30 20:51:06 x10m-0000 bash[678]:     config = confighelper.get_configuration(self, self.app_args)
Jun 30 20:51:06 x10m-0000 bash[678]:              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jun 30 20:51:06 x10m-0000 bash[678]:   File "/home/printnanny/.moonraker/moonraker/confighelper.py", line 1042, in get_configuration
Jun 30 20:51:06 x10m-0000 bash[678]:     raise ConfigError("No section [server] in config")
Jun 30 20:51:06 x10m-0000 bash[678]: confighelper.ConfigError: No section [server] in config
Jun 30 20:51:06 x10m-0000 bash[678]: [moonraker.py:main()] - Server Shutdown
Jun 30 20:51:06 x10m-0000 systemd[1]: moonraker.service: Main process exited, code=exited, status=1/FAILURE
Jun 30 20:51:06 x10m-0000 systemd[1]: moonraker.service: Failed with result 'exit-code'.

Issue.txt

-----------------------
Build Info:  |
-----------------------
IMAGE_NAME = printnanny-release-image-raspberrypi4-64-20230528210042
DISTRO_PRETTY = PrintNanny Linux 0.7.2 (Garnet)
VARIANT_NAME = PrintNanny OS Core
VARIANT_ID = core
DISTRO = printnanny
DISTRO_NAME = PrintNanny Linux
DISTRO_VERSION = 0.7.2
DISTRO_CODENAME = Garnet
ID_LIKE = BitsyLinux
HOME_URL = https://printnanny.ai
BUG_REPORT_URL = https://github.com/bitsy-ai/printnanny-os/issues
YOCTO_VERSION = 4.1.2
YOCTO_CODENAME = Langdale
MACHINE = raspberrypi4-64
TUNE_PKGARCH = cortexa72
-----------------------
Layer Revisions:      |
-----------------------
meta              = mickledore:ddb298ce894482467d82699d223c5555baad6591
meta-poky         = mickledore:ddb298ce894482467d82699d223c5555baad6591
meta-yocto-bsp    = mickledore:ddb298ce894482467d82699d223c5555baad6591
meta-oe           = mickledore-polkit-src:4321a5fd17fa2c307ca579ae76b921fb4c560bfa
meta-networking   = mickledore-polkit-src:4321a5fd17fa2c307ca579ae76b921fb4c560bfa
meta-python       = mickledore-polkit-src:4321a5fd17fa2c307ca579ae76b921fb4c560bfa
meta-webserver    = mickledore-polkit-src:4321a5fd17fa2c307ca579ae76b921fb4c560bfa
meta-initramfs    = mickledore-polkit-src:4321a5fd17fa2c307ca579ae76b921fb4c560bfa
meta-bitsy        = upgrade-printnanny-rs-deps:7e551cb649692815d9ff1c300dbbaef13bae338b
meta-microcontroller = mickledore:a848733698649628d0c3e34ae04ced0ee6ce3aee
meta-neural-network = mickledore:39f06bfa582eedc8621df677bb5cf044e9481309
meta-raspberrypi  = issue-1167-raspberrypi-hq-camera:26a25492a639310bb94afd4b2b066895c9217bad
meta-swupdate     = master:19007b03a1d96eca38e12f3bbd7bb296aea50bab
meta-printnanny   = upgrade-printnanny-rs-deps:7e551cb649692815d9ff1c300dbbaef13bae338b
meta-multimedia   = mickledore-polkit-src:4321a5fd17fa2c307ca579ae76b921fb4c560bfa
@leigh-johnson leigh-johnson added the bug Something isn't working label Jul 5, 2023
@leigh-johnson leigh-johnson self-assigned this Jul 5, 2023
@leigh-johnson leigh-johnson added this to the 0.7.3 milestone Jul 5, 2023
@leigh-johnson leigh-johnson changed the title Default moonraker.conf results in error: confighelper.ConfigError: No section [server] in config Validate Moonraker conf on save Jul 5, 2023
@leigh-johnson
Copy link
Member Author

After digging in a bit more, it turns out the reporter removed the [server] section from their moonraker.conffile. Updating this issue to an enhancement, which is to validate conf on load/save.

@leigh-johnson leigh-johnson added enhancement New feature or request component:moonraker and removed bug Something isn't working labels Jul 5, 2023
@leigh-johnson
Copy link
Member Author

leigh-johnson commented Jul 5, 2023

While we're on Moonraker / Klipper config, I think we should improve our documentation on enabling Moonraker / Klipper / Mainsail and setting up printer.cfg.

Right now, we ship a default printer.cfg that doesn't work with ANY printer out of the box, but we don't provide detailed instructions about how to proceed. https://github.com/bitsy-ai/printnanny-settings/blob/main/klipper/printer.cfg

  1. We should reference the defaults/examples here:
    https://github.com/Klipper3d/klipper/tree/master/config

  2. We should provide common mainsail / printnanny config partials, and allow the user to write the rest of printer.cfg, e.g.

[include mainsail.cfg]
[include printnanny.cfg]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant