771 Commits

Author SHA1 Message Date
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
01141fa10e
git_deploy: validation improvements
Add a check for shallow repos and move validation logic to the
GitRepo class.  Additionally report the real number of commits behind.

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
011179ca6d
git_deploy: improve submodule validation
Submodules contain a .git file that includes the path to the
actual repository folder.  Extract that path and use it for
lock file detection.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-07-13 07:58:40 -04:00
Eric Callahan
270c78d8af
git_deploy: refactor initialization
Use git-branch to determine current the current branch and
head state instead of git-status.  The former is a porcelain
command with guaranteed output.

Signed-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
1c16233da0
git_deploy: rollback improvements
Streamline the rollback defaults so only one dict object
is explicitly defined in "capture_state_for_rollback()".
Validate the rollback branch on detached heads before
setting it.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-07-12 13:57:26 -04:00
Eric Callahan
9651923f8e
git_deploy: fetch partial clones for hard recovery
It isn't necessary to download and decompress all blobs.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-07-12 13:57:26 -04:00
Eric Callahan
3e875b583c
git_deploy: add support for stable updates
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-07-12 13:57:25 -04:00
Eric Callahan
1a4480e74c
git_deploy: use versions utility
Use the newly implemented versions utility for git version parsing.
This allows for simple access to version information and
version comparison.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-07-12 13:57:25 -04:00
Eric Callahan
69710e10e0
update_manager: reset to correct commit after recovery
If a git repo not configured on the dev channel it is necessary
to move the HEAD to the commit for the correct tag.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-07-12 13:57:24 -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
d51820f48c
metadata; use python's logging module
Replace calls to `log_to_stderr` with standard logging.<level> calls.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-07-09 12:01:27 -04:00
Eric Callahan
5691a4f162
shell_command: don't log the program name
When logging stderr in realtime omit the program name.  It often
does not provide useful context.  The program itself can provide
context through its own logging facilities.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-07-09 11:31:29 -04:00
Eric Callahan
c3c3170451
file_manager: log metadata response in real time
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-07-09 11:31:19 -04:00
Eric Callahan
8eddec88cb
dbus_manager: handle all PolKit interface errors
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-07-06 16:56:11 -04:00
Eric Callahan
499d9adbe0
job_queue: don't run transition gcode on start
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-06-29 11:28:10 -04:00
Eric Callahan
93f473f629
spoolman: correct API registration
Internal Moonraker APIs must be registered with a top level path of
"server" or "machine".

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-06-27 16:23:56 -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
a237ba3735
spoolman: add remote method to set active spool
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-06-26 16:52:13 -04:00
Eric Callahan
0592181f54
shell_command: propogate asyncio cancel exceptions
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-06-26 16:48:47 -04:00
Eric Callahan
1d3e5564a2
git deploy: use python requirements file for updates
The package parsing only serves the purpose of performing the diff.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-06-26 16:48:47 -04:00
Eric Callahan
1cfeb853a5
update_manager: improve logging
Add a debug logging helper to the base class.  Use unique
logging prefixes for subclasses of AppDeploy.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-06-26 16:48:47 -04:00
Eric Callahan
4edfbce3ce
app_deploy: refactor configuration handling
Move specific configuration out of __init__ into several methods
that may be called by subclasses.   This allows child implementations
to define and share specific sets of configuration that they require
without forcing all implementations to do so.

Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2023-06-26 16:48:46 -04:00
Eric Callahan
ee8f77c8c6
update_manager: disable repo binding
Remove hardcoded beta binding between Moonraker and Klipper.
This could result in a user getting stuck on a commit that requires
a future patch.

The original purpose of binding versions was to avoid a scenario
where Klipper introduces a feature incompatible with the current
Moonraker beta.  Rather than binding the  better solution is to
fix the incompatibility and tag a new beta.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-06-26 16:48:46 -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
b2d84bc733
update_manager: handle app entry points
If the exectuable in the virtualenv is not "python" attempt to
detect the python executable.  Use the pip entry point for the
pip command.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-06-26 16:48:45 -04:00
Eric Callahan
5d54a10177
spoolman: minor fixes
Set the minimum value for the sync_rate to 1 second, rather
than above 1 second.  When transitioning from a null spool
to a named spool clear tracked extrusion.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-06-26 16:38:19 -04:00
Donkie
4b9c836743
spoolman: Added basic spoolman integration
Proxies any request to the spoolman server. Records filament usage.

Signed-off-by: Daniel Hultgren <daniel.cf.hultgren@gmail.com>
2023-06-26 16:24:40 -04:00
Eric Callahan
1f0fd699ea
zeroconf: add support for ssdp discovery
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-06-24 18:08:08 -04:00
Eric Callahan
95d5f045db
zeroconf: add support for configurable mdns hostnames
Signed-off-by:  Eric Callahan <aksine.code@gmail.com>
2023-06-22 06:18:01 -04:00
Eric Callahan
adc32379da
zeroconf: improve mulit-instance handling
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-06-22 06:18:00 -04:00
Eric Callahan
3b62ed4e4f
dbus_manager: fix polkit warning
Only warn that polkit is unavailable when a component attempts
to use it to check a permission.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-06-20 11:59:41 -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
a7b9e5783d
git_deploy: relax validation requirements
Do not report invalid if the remote or branch does not match
the configured values.  In these conditions report them as
"repo_warnings" that frontends may display to the user.

Hard recovery now requires a recovery URL detected from the git
repo's "origin" remote.  This closes a potential security issue where a
malicioius repo could be cloned over an installed repo.

Signed-off-by:  Eric Callahan <arskine.code@gmail.com>
2023-06-20 11:59:40 -04:00
Eric Callahan
d6231634db
history: add modified time check for file existence
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-06-01 05:50:31 -04:00
Eric Callahan
c41c5881c8
git_deploy: fix tag format specifier
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-05-26 14:51:16 -04:00
Eric Callahan
c609060352
app_deploy: escape pip requirements installed via command line
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-05-26 07:57:09 -04:00
Chris Thornton
b21f177e95 notifier: Add body_format as an option
This lets you format the messages through apprise a little nicer

Signed-off-by: Chris Thornton <cwgthornton@gmail.com>
2023-05-07 05:59:43 -04:00
Eric Callahan
cf56a1cdcd
webcam: add new fields
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-04-23 07:30:07 -04:00
Eric Callahan
ac10b4a3b9
http_client: don't store client in the wrapper
This closes a securitiy vulernability where the client could
be used to download and save a file from any configured
location.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-04-18 08:09:55 -04:00
Eric Callahan
53d9522c06
sensors: measurement request fix
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-04-18 08:09:54 -04:00
Eric Callahan
204e7ca4ff
power: add support for generic http sensors
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-04-14 07:43:28 -04:00
Eric Callahan
d393c89ae0
http_client: add a http request wrapper
This wrapper is an object that may be used to build requests
procedurally rather than submit all request parameters in
a call to "request()", "get()", etc.  This is primarily useful for
usage in a Jinja2 context.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-04-05 06:13:08 -04:00
Eric Callahan
31e589abde
job_queue: fix erronous state after start
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-04-04 11:07:16 -04:00
Eric Callahan
6b73da55f8
job_queue: never transition after complete unless auto is enabled
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-04-04 11:03:12 -04:00