From 210f505157f6940067c939df9d42f4aa23680853 Mon Sep 17 00:00:00 2001 From: Arksine <9563098+Arksine@users.noreply.github.com> Date: Mon, 29 Mar 2021 12:36:31 -0400 Subject: [PATCH] docs: document changes to the update_manager Signed-off-by: Eric Callahan --- docs/configuration.md | 6 ++++++ docs/web_api.md | 46 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/docs/configuration.md b/docs/configuration.md index 2e9840b..88a4694 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -405,4 +405,10 @@ install_script: # The file location, relative to the repository, for the installation script. # The update manager parses this file for "system" packages that need updating. # The default is no install script, which disables system package updates +enable_node_updates: +# When set to True, Moonraker will asssume that this repo relies upon node +# and will attempt to execute "npm ci --only=prod" when it detects a change +# to package-lock.json. Note that if your project does not have a +# package-lock.json in its root directory then the plugin will fail to load. +# Default is False. ``` diff --git a/docs/web_api.md b/docs/web_api.md index c5588b9..b30e05e 100644 --- a/docs/web_api.md +++ b/docs/web_api.md @@ -1755,6 +1755,7 @@ and `fluidd` are present as clients configured in `moonraker.conf` "tag": null } ], + "git_messages": [], "is_valid": true, "debug_enabled": true } @@ -1796,6 +1797,12 @@ as git repos have the following fields: - `commits_behind`: A list of commits behind. Up to 30 "untagged" commits will be reported. Moonraker checks the last 100 commits for tags, any commits beyond the last 30 with a tag will also be reported. +- `git_messages`: If a repo is in the "invalid" state this field will hold + a list of string messages containing the output of the last failed git + command. Note that it is possible for a git command to fail without + providing output (for example, it may become non-responsive and time out), + so it is possible for this field to be an empty list when the repo is + invalid. Web clients have the following fields: @@ -1900,6 +1907,45 @@ Returns: `ok` when complete +#### Recover a corrupt repo +On ocassion a git command may fail resulting in a repo in a +dirty or invalid state. When this happens it is possible +to recover. The `name` argument must specify the name of +the repo to recover, it must be of a git repo type. There are two +methods of recovery, the `hard` argument determines which method +is used: + +- `hard == true`: Moonraker will remove the old directory + entirely. It will then attempt to recover with `rsync` + by restoring a backup of a recent valid repo. +- `hard == false`: Will run `git clean -f -d` followed + by `git reset --hard {remote}/{branch}`. This is useful + for recovering dirty repos that are valid. It is possible + that this will work on an invalid repo, however it will + not work on a corrupt repo. + +The `hard` argument defaults to `false`. + +HTTP request: +```http +POST /machine/update/recover?name=moonraker&hard=false +``` +JSON-RPC request: +```json +{ + "jsonrpc": "2.0", + "method": "machine.update.recover", + "params": { + "name": "moonraker", + "hard": false + }, + "id": 4564 +} +``` +Returns: + +`ok` when complete + ### Power APIs The APIs below are available when the `[power]` component has been configured.