The Klipper repo always initializes last. Send a notification at this time, so if any clients are connected they can receive the full update status after init.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
During normal updates dependencies will always been updated when necessary. It is possible to force a dependency updating using the new "/machine/update/recover" endpoint.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Gives callers flexibility as to which signal is used to cancel a command first. By default shell_command will start with SIGTERM, then proceed to SIGKILL.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Rather than attempt to automate recovery, provide an endpoint for clients
to initiate. Clients can choose between a "hard" recovery, which removes
a corrupt repo and restores from a backup, or a "soft" recover which attempts
a git clean followed by a git reset.
Backups are now only taken when a valid repo is detected.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Note that this does not replace references to "Cura" or "Octoprint" plugins, which are also included in this module.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
It isn't necessary for each updater to have their own init lock. Combine them all into a single Event that is set after the "initialize_updaters" method completes.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Give more time for a standard command to complete. This may help prevent a git command from being terminated prematurely.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
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>