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>
When possible record the name of the user that requested the
job. The klippy_api's component now takes an optional user
argument in its "start_print" method. This user is broadcast
in an event after a print request successfully returns.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Some installations, such as those in public areas, may wish disallow
changes to the configuration.
This option defaults to True, so no change in behavior is introduced.
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>
Some installations do not have Klipper's configuration
in the data path's "config" folder. Provide a way to
opt out of this check.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Use EAFP techniques to test for directory read permission
during registration. If access fails continue with registration.
This allows users to potentially fix an issue without restarting.
Inotify failures always require a restart to resolve.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
If the user creates or moves a folder that was is reserved
reserved correctly ignore or remove watches as appropriate.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Desktop class PCs may exit the request before the inotify observer
gains control of the loop. When the observer does gain control
it will immediately notify as the sync mutex is no longer held,
this can result in sending the websocket notification before
the response has returned. Delay all notifications by 5ms to prevent
this.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Support manual scan requests for systems where inotify
does not function correctlly (network shares). This endpoint
may also be used to force a rescan of files that have already
had an initial scan.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Previously Moonraker disabled writing to symbolic links, as
doing so would overwrite the link. Moonraker now resolves
the link, overwrites the file, and manually emits a websocket
notification.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Schedule fallback websocket notifications in the event that
inotify is unable to watch a file system.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Treat these events as if they were actual file write events. They
will reset the node completion time and suppress the notifcation.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
It is possible for a move event to occur shortly after a directory
is created. These events are not bundled as part of an operation
like "copy", so they should not be suppressed, however the
notification should be emitted after the "create_dir" from its
parent is emitted.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
All of the awaitable calls in the inotify loop only block to
postpone notifications. Only gcode notifications require async
processing due to metadata analysis. Queue these notifications
while allowing inotify events to be received concurrently.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
fix
Most requests do not require waiting for inotify to process the
file event before exiting. Rework the NotifySyncLock to make this
optional. Replace the write mutex with the sync lock itself,
a guarantee that the synchronization state is cleaned up when
a request is complete.
This implementation avoids potential deadlocks or long wait times
when inotify is not enabled on a file system.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Include the reserved file check in the `can_access_path()` method. This
fixes a potential vulnerability in the notifier where it may be possible
to attach a reserved file to a notification.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Provides an API for front ends to archive a list of files and/or
folders into a single zipped file.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
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>
Do not add inotify watches for reserved paths that exclude
write acccess. Do not return include reserved paths in
file list requests without read access.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>