96 Commits

Author SHA1 Message Date
Eric Callahan
0ff1d79b5b server: improve add_warning method
Add an exc_info parameter that optionally takes an
exception that is passed to the logging function. This
will log the traceback without an additional logging call.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-07-24 07:37:08 -04:00
Eric Callahan
379a26600c
update_manager: use temporary file storage for iids
The default behavior of systemd is to remove shared memory
files when the user that created them logs out.  This breaks
instance ID tracking for most installations.  While its possible
to overcome this by changing the user type or the logind
configuration, these solutions required elevated privileges.
The simple solution is to store iids in a temporary file, with
access protected by a flock.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-04-27 10:52:22 -04:00
Eric Callahan
10dfb0d477
update_manager: improve instance detection
Implement instance package wide for the update_manager.  This
only requires detecting multiple instances once and eliminates
costly calls to git.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-03-11 06:26:17 -04:00
Kamil Domański
04b1103778 Allow configuring the update refresh window
This enables customizing the time of day within which periodic refresh occurs.

Previously docs said it happens between 12am-4am which is misleading,
because the code effectively allowed refresh until 4:59:59 AM.
The default window is now '0-5', which is practically the same as before.

The comment about checking every 24h hours has been fixed as well.
This hasn't been true since commit c4fa76f21792943ea512d24326259f01d2fa7e89

Signed-off-by: Kamil Domański <kamil@domanski.co>
2024-02-17 12:41:51 -05:00
Eric Callahan
994123e92e
update_manager: use ZipDeploy to instantate web types
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-01-21 08:24:05 -05:00
Eric Callahan
ddd735feba
refactor: convert klippy_connection into a component
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-01-13 15:15:15 -05:00
Eric Callahan
f1de614027
shell_command: refactor retrires to attempts
This is consistent with the http_client.  The argument "attempts" is more
accurate than retries, as the first attempt is not a retry.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-01-11 16:51:41 -05:00
Eric Callahan
6e6388d673
update_manager: fix race condition
Previously the Klipper repo location can be changed outside of
the lock.  If the location of the Klipper path is moved while an autorefresh is occurring it is possible for Moonraker to call refresh
and/or notify_update_refreshed before the repo has been initialized.

This commit moves the re-assignment of the "klipper" updated inside
the lock.  In addition AppDeploy._is_valid is now defined in the
__init__() method.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-01-06 11:54:33 -05:00
Eric Callahan
19422819da
app_deploy: add support for pip environment vars
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-12-28 08:05:43 -05:00
Eric Callahan
b18e9cc222
all: Replace strings with RequestType flags
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-12-16 16:21:20 -05:00
Eric Callahan
40011370a3
update_manager: improve Klipper detection
If the Klipper installation is not updatable (ie not a git repo)
abort reinstantion of the deployer.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-11-02 06:19:14 -04:00
Eric Callahan
9b1eed534b
update_manage: move web update deployer to its own module
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-07-14 12:43:57 -04:00
Eric Callahan
f46cc32be3
update_manager: move package management to its own module
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-07-14 12:40:18 -04:00
Eric Callahan
4f785cfca0
update_manager: clarify web client git warning
When the parent folder of a web client is a git repo note the specific
directory that contians a .git subdirectory.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-07-14 12:40:17 -04:00
Eric Callahan
4443bfbd41
update_manager: improve package manager logging
Assign a custom prefix for the configured provider.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-07-13 07:58:41 -04:00
Eric Callahan
51e3568aac
update_manager: add git repo instance detection
Use git-config to set track the current Moonraker instance managing a
a git repo.  If multiple  instances are detected log and create a repo
warning.

Singed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-07-13 07:58:40 -04:00
Eric Callahan
3f1e9e397e
update_manger: log remaining refresh time on init
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-07-12 13:57:27 -04:00
Eric Callahan
41d945803f
update_manager: replace string choices with enums
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-07-12 13:57:24 -04:00
Eric Callahan
c903dd6af4
update_manager: implement update rollback support
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-07-12 13:55:47 -04:00
Eric Callahan
26975e055b
update_manager: fix klipper instantiation on path switch
Signed-off-by:  Eric  Callahan <arksine.code@gmail.com>
2023-07-12 13:50:47 -04:00
Eric Callahan
2ef4dc4d8e
update_manager: fix initial name parsing
This fixes an issue where a configuration name with spaces
may not match the reported name.

Signed-off-by:  Eric Callahan <arksine.code>
2023-06-27 12:26:58 -04:00
Eric Callahan
5f43536612
update_manager: update base channel config
Allow independent channel configuration for Moonraker and
Klipper.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-06-27 12:16:57 -04:00
Eric Callahan
a1e786fd73
update_manager: fix defaults for base configuration
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-06-27 12:10:19 -04:00
Eric Callahan
357276b1d9
update_manager: remove unused reinstall functionality
This functionality was intended to allow for an automated
reinstallation between "git_repo" and "zip" types.  The
"zip" type remains unused, and attempting to automate
this would likely be unreliable.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-06-26 16:48:45 -04:00
Eric Callahan
a797dd0b50
update_manager: validate web type installations
Require that "web" installations provide release info to validate
existing installations.  For known web clients provide a fallback
that uses the manifest to validate the installation.

Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2023-06-20 11:59:41 -04:00
Eric Callahan
6a5a5b50d3
update_manager: validate web_request args
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-24 10:26:16 -05:00
Eric Callahan
6d73c60a38
moonraker: move common classes to common.py
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-24 07:08:41 -05:00
Eric Callahan
e32fd688e4
moonraker: correct stale annotations
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-22 18:08:50 -05:00
Eric Callahan
0f8638fec7
components: correct imports
All imports must now be relative to work correctly with the
moonraker parent package.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-22 12:16:27 -05:00
Eric Callahan
a5d63db9a6
server: rename moonraker.py to server.py
Signed-off-by:  Eric Callahan <arksiine.code@gmail.com>
2023-02-21 18:05:01 -05:00
Eric Callahan
01977c8775
update_manager: refactoring
Code style and naming convention improvements.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-06 07:50:08 -05:00
Eric Callahan
c8ad69b902
update_manager: add individual refresh endpoint
This endpoint allows clients to refresh items on an individual basis
when the "name" parameter is specified.  This endpoint replaces

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-06 06:42:56 -05:00
Eric Callahan
f50fa3c5e7
update_manager: add package resolution check to apt backend
Make sure packages within the package list exist prior to installation.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-05 19:25:54 -05:00
Eric Callahan
c1e4142a40
update_manager: add arch filter
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-31 14:00:54 -05:00
Eric Callahan
b02e766a4d
update_manager: log detected packages
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-31 14:00:54 -05:00
Eric Callahan
ecf7fb9267
klippy_connection: add is_printing() and is_ready() methods
Several components throughout Moonraker determine whether or not
Klipper is printing or is ready before taking action.  This centralizes
queries in one area.  The checks do not query Klipper directly but
rather rely on subscriptions to push state to Moonraker.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-06 12:20:52 -05:00
Eric Callahan
59cc8c6c7b
update_manager: report errors in update response
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-20 16:54:35 -04:00
Eric Callahan
e4a670a380
update_manager: improve corrupt repo detection
It that "git status" will not detect some repo issues, these are only
found after a fetch.  When this condition is detected save the repo
state and report that the repo is corrupt and invalid.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-20 16:54:34 -04:00
Eric Callahan
c7e290a3cd
update_manager: improve web client error handling
Singed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-19 17:58:58 -04:00
Eric Callahan
b9cac62db8
update_manager: log when refresh is bypassed
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-15 11:07:31 -04:00
Eric Callahan
65e24a14dc
update_manager: do not refresh when install validation is pending
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-15 10:52:05 -04:00
Eric Callahan
485b29490a update_manager: deprecate repo debug option
Use the "debug" command line option to enable debug
features for the update manager.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-14 15:15:41 -04:00
Eric Callahan
86fc1057f7 server: deprecate debug logging option
Add a debug option to the command line to enable
debug features.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-14 15:15:41 -04:00
Eric Callahan
069a655df8 file_manager: update reserved path handling
Allow components to register reserved paths, then perform reserved
path validation it upon request.  Reserved paths may be registered as
read-only or no access.  Any request to modify an file/folder that is
either reserved or a child of a reserved path is rejected.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-14 15:15:41 -04:00
Eric Callahan
853de9e8cb
update_manager: resolve potential deadlocks on startup
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-18 07:17:54 -04:00
Eric Callahan
3080885257
update_manager: change default refresh interval
Check for updates every 7 days rather than every 28 days.  This
is in preparation of an upcoming beta release.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-07-17 06:13:50 -04:00
Eric Callahan
72a85e08d4
update_manager: refactor extension instantation
Don't allow extension errors to propagate, warn and continue
loading the module instead.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-04 11:46:24 -04:00
Eric Callahan
03934d8d81
update_manager: deprecate web_beta type
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-04 11:46:23 -04:00
Eric Callahan
e9e86c3042
update_manager: refactor AppDeloy class
Don't require the `app_params` argument, instead dynamically
generate the configuration from a dict.  This simiplifies AppDeploy
initialization as the internally generated configurations can be
read in the same way as those supplied in moonraker.conf.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-04 11:46:21 -04:00
Eric Callahan
93b62236de
update_manager: reorder update instances
Instantiate the moonraker instance first, then Klipper.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-04 11:46:21 -04:00