Git repos can occasionally become corrupted when attempting to deploy updates thought automated means. Use rysnc to create a backup of each git repo, allowing the repo to be restored in the event of a corrupted repo.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Since "run_with_response" now raises an exception there is no need to inspect the response for a None type. Instead the exception can be handled by the caller directly.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This error contains the return code and anything received from stdout and stderr when "run_with_response" encounters an error. This allows the caller to receive the output and easily distinguish between a successfully run command and an erronous command.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Sometimes git will erroneously leave the lock file in place when a command fails. Check for locked git repo before initialization, waiting up to 60 seconds before forcefully removing the lock. Also check for a locked repo after a failed fetch or pull, removing it if it exists.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Git clients may specify a branch other than "master" as the primary to pass the validation checks.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit adds mkdocs.yml and modifies the existing markdown documentation so that "readthedocs" can build documentation using "mkdocs".
Included are many formatting changes and fixes to the existing documentation so that it shows up correctly when published.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This field does not persist in the database as it is subject change if a file is moved or deleted when Moonraker is not running.
Also add thumbnail information to the metadata sans the base64 image data for each entry.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Other modules may look up this plugin to determine if a particular file exists at the specified root.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Include a relative path the the thumbnail in the metadata. This commit deprecates base64 image transfers. A future commit will remove base64 data from the metadata, clients will be expected to retrieve thumbnails as a static file.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Moonraker now checks the modified time of both the install script and requirements file for git repos. If either is out of date their associated dependencies will be installed.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This ensures that jobs in the database will be stored in the order they were started. Doing so also eliminates the need for the `history_auto_inc_id", as we can initialize the next id from the database keys.
This also caches history keys in memory so we do not need to read them from the database on each access.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Add an additional checks to determine if a job needs to be cancelled when we receive a new "printing" state. A file name mismatch or a decrease in total_duration indicates a virtual sdcard reset.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Add GET and DELETE `/server/history/job` APIs and remvoe the `DELETE /server/history/delete` API. When returning a list of jobs, return it as an array rather than as a object. The `/server/history/list` API no longer accepts a job id.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This allows the repo init sequence to distinguish between a broken git repo and an invalid git repo.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
If a trusted IP address is passed as the origin then it is safe to assume that CORS access to this origin should be granted, but only if CORS is enabled by specifying at least one cors domain.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
A user may unintentionally allow access to dangerous domains if they place a wildcard in the top level domain portion of an entry. Raise a config error when this condition is detected.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Move git command functionality to its own class outside of the Updater class. This class is responsible for tracking repo state and executing commands on the repo. Fetch and Pull no longer use built in command timeouts, instead a callback is scheduled to see if the command returned progress. Only when no progress is returned will a fetch or pull be terminated after a timeout.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This class handles running shell commands and sending http API requests. Each updater class shares an instance of the command helper rather than the UpdateManager instance.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
In the "run()" method verbosity should still be allowed if log_stderr is True, even
if both callbacks are not set.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This allows plugins to interact with other plugins before they are closed. For example, a plugin may wish to save persistent state to the database before it is closed.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>