Variables should be contained within the spoolman instance, as in the
future it could be desirable to support multiple instances.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
If Klipper is using systemd socket activation to generate its
unix socket the PID reported by PEERCRED will be 1, that of
systemd itself. Klipper now reports its process id in the
"info" endpoint, use that as a fallback to retreive service info.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
It is possible that Moonraker cannot bind to an address if its
already in use. Handle bind errors and warn/log when they are
encountered.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Moonraker dynamically registers its routes, so we cannot easily
use the routers provided by tornado.Application. Previously
all routes went through tornado.Application, then went to
our mutable router. This refactor avoids that by having our
mutable router contain the tornadoapp instance, only using
it to provide the application delegate.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
It is desirable to use templates (and therefore secrets) in
the server's configuration options. We need to defer loading
the "file_manager", remove its dependency from secrets. When
the file_manager is loaded it will look up "secrets" and register
the file path as reserved.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
It is possible that older versions of Moonraker's update_manager
will fail in its attempt to update python packages. This can lead
to missing modules when the new version of Moonraker is loaded.
When a `ModuleNotFound` error is received during a call to
"load_component" Moonraker will attempt to install its
missing dependencies.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This module implements both syncronous and async calls
to pip, separating it from the rest of the application. The
syncronous implementation has no dependencies on Moonraker.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
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>
If the destination file exists it is necessary to explicitly use
the filename to overwrite. Otherwise an error is generated.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
The python-periphery library XORs the initial value based on
whether or not its inverted. This requires consumers to set
the direction to "high" for inverted pins that are off, and
"low" otherwise.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Starting in Python 3.12 uvloop.install() is deprecated. Directly
set the event_loop_policy as advised by the documentation.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
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>
Add a local fallback link with a pure python wheel to
prevent build issues on systems where cython wheels are
not available.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Clear the API cache when closing to purge stale callbacks. In addition,
explicitly delte the server object after the eventloop stops.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Some distros have older versions of py-lmdb installed
that do not implement "Cursor.getmulti()". Add a workaround for "get_batch()".
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Don't generate additional "unparsed option" warnings when
a component fails to load. When an error is encountered,
include the original error message in the subsequent
ConfigError.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Use the ConfigHelper as an intermediary to register GPIO event
pins. This allows for parsing exceptions to be captured and
properly re-raised as Config Errors.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Use a traditional debouncing method, waiting for a specified
debounce period before triggering events. Consumers may
choose to futher ignore events based on the the duration
between events.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
The libgpiod library has breaks API compatibility with version 2.
Given that not all distributions ship gpiod and its unique nature
as a system package, replace it with a wrapper that directly
accesses the GPIO character device.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Add a POST /server/jsonrpc endpoint that processes jsonrpc
requests from the body. This allows developers familiar with
the JSON-RPC API to use it in places where a websocket is not
desiriable.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Only log registration when verbose (debug) logging is enabled.
In addition, log endpoint removal.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Track authentication requirements in the API Definition. This
eliminates the need to look up the authentication component
to disable auth on an endpoint.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>