mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-17 23:33:12 +09:00
Add update all for the controller, hosts and plugins
Updating a single plugin can leave the installation with multiple versions of @clusterio/lib. Passing the core package and every npm installed plugin to a single npm update call lets npm resolve them together. UpdateAllRequest targets the controller or a host, requires both the core update permission and core.plugin.update, and is gated by both allow_remote_updates and allow_plugin_updates. The web UI Updates modal gets an Update All action and ctl gets --all on the update commands. Closes #910 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
7987a5d925
commit
7ff2092547
11 files changed
+158
-7
No files matched your search
@@ -28,9 +28,14 @@ controllerCommands.add(new lib.Command({
|
||||
controllerCommands.add(new lib.Command({
|
||||
definition: ["update", "Update the controller", (yargs) => {
|
||||
yargs.option("restart", { alias: "r", type: "boolean", description: "Restart after update" });
|
||||
yargs.option("all", { alias: "a", type: "boolean", description: "Also update all plugins" });
|
||||
}],
|
||||
handler: async function(args: { restart: boolean }, control: Control) {
|
||||
await control.send(new lib.ControllerUpdateRequest());
|
||||
handler: async function(args: { restart: boolean, all: boolean }, control: Control) {
|
||||
if (args.all) {
|
||||
await control.send(new lib.UpdateAllRequest());
|
||||
} else {
|
||||
await control.send(new lib.ControllerUpdateRequest());
|
||||
}
|
||||
if (args.restart) {
|
||||
await control.send(new lib.ControllerRestartRequest());
|
||||
} else {
|
||||
|
||||
@@ -101,10 +101,15 @@ hostCommands.add(new lib.Command({
|
||||
definition: ["update <host>", "Update the host", (yargs) => {
|
||||
yargs.positional("host", { describe: "Host to update", type: "string" });
|
||||
yargs.option("restart", { alias: "r", type: "boolean", description: "Restart after update" });
|
||||
yargs.option("all", { alias: "a", type: "boolean", description: "Also update all plugins" });
|
||||
}],
|
||||
handler: async function(args: { host: string, restart: boolean }, control: Control) {
|
||||
handler: async function(args: { host: string, restart: boolean, all: boolean }, control: Control) {
|
||||
let hostId = await lib.resolveHost(control, args.host);
|
||||
await control.sendTo({ hostId }, new lib.HostUpdateRequest());
|
||||
if (args.all) {
|
||||
await control.sendTo({ hostId }, new lib.UpdateAllRequest());
|
||||
} else {
|
||||
await control.sendTo({ hostId }, new lib.HostUpdateRequest());
|
||||
}
|
||||
if (args.restart) {
|
||||
await control.sendTo({ hostId }, new lib.HostRestartRequest());
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user