hostctl 0.1.57 → 0.1.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/hostctl.js +911 -593
- package/dist/bin/hostctl.js.map +1 -1
- package/dist/index.d.ts +76 -44
- package/dist/index.js +879 -561
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/bin/hostctl.js
CHANGED
|
@@ -14,7 +14,7 @@ import "zod";
|
|
|
14
14
|
|
|
15
15
|
// src/app.ts
|
|
16
16
|
import process3 from "process";
|
|
17
|
-
import * as
|
|
17
|
+
import * as fs10 from "fs";
|
|
18
18
|
import { homedir as homedir3 } from "os";
|
|
19
19
|
|
|
20
20
|
// src/handlebars.ts
|
|
@@ -1839,8 +1839,12 @@ var TmpFileRegistry = class _TmpFileRegistry {
|
|
|
1839
1839
|
constructor(rootPath) {
|
|
1840
1840
|
this.rootPath = Path.new(rootPath);
|
|
1841
1841
|
this.tempFilePaths = [];
|
|
1842
|
+
this.ensureRootPathExists();
|
|
1842
1843
|
process2.on("exit", (code) => this.exitCallback());
|
|
1843
1844
|
}
|
|
1845
|
+
ensureRootPathExists() {
|
|
1846
|
+
fs.mkdirSync(this.rootPath.toString(), { recursive: true });
|
|
1847
|
+
}
|
|
1844
1848
|
randName() {
|
|
1845
1849
|
return Math.random().toString(36).slice(-5) + Math.random().toString(36).slice(-5);
|
|
1846
1850
|
}
|
|
@@ -1857,6 +1861,7 @@ var TmpFileRegistry = class _TmpFileRegistry {
|
|
|
1857
1861
|
}
|
|
1858
1862
|
// this file will be automatically cleaned up at program exit
|
|
1859
1863
|
writeTmpFile(fileContent) {
|
|
1864
|
+
this.ensureRootPathExists();
|
|
1860
1865
|
const path14 = this.tmpPath();
|
|
1861
1866
|
fs.writeFileSync(path14.toString(), fileContent);
|
|
1862
1867
|
this.registerTempFileOrDir(path14.toString());
|
|
@@ -1898,6 +1903,7 @@ var Host = class {
|
|
|
1898
1903
|
this.user = opts.user;
|
|
1899
1904
|
this.password = opts.password;
|
|
1900
1905
|
this.sshKey = opts.sshKey;
|
|
1906
|
+
this.sshKeyPassphrase = opts.sshKeyPassphrase;
|
|
1901
1907
|
this.tags = opts.tags ?? [];
|
|
1902
1908
|
this.tagSet = new Set(this.tags);
|
|
1903
1909
|
}
|
|
@@ -1909,6 +1915,7 @@ var Host = class {
|
|
|
1909
1915
|
user;
|
|
1910
1916
|
password;
|
|
1911
1917
|
sshKey;
|
|
1918
|
+
sshKeyPassphrase;
|
|
1912
1919
|
tags;
|
|
1913
1920
|
tagSet;
|
|
1914
1921
|
async decryptedPassword() {
|
|
@@ -1928,6 +1935,16 @@ var Host = class {
|
|
|
1928
1935
|
return await secret?.plaintext();
|
|
1929
1936
|
}
|
|
1930
1937
|
}
|
|
1938
|
+
async decryptedSshKeyPassphrase() {
|
|
1939
|
+
if (V(this.sshKeyPassphrase).isA(SecretRef)) {
|
|
1940
|
+
const secretRef = this.sshKeyPassphrase;
|
|
1941
|
+
const secret = this.config.getSecret(secretRef.name);
|
|
1942
|
+
return await secret?.plaintext();
|
|
1943
|
+
}
|
|
1944
|
+
if (typeof this.sshKeyPassphrase === "string") {
|
|
1945
|
+
return this.sshKeyPassphrase;
|
|
1946
|
+
}
|
|
1947
|
+
}
|
|
1931
1948
|
toYAML() {
|
|
1932
1949
|
let passwordForYaml = this.password;
|
|
1933
1950
|
if (this.password && V(this.password).isA(SecretRef)) {
|
|
@@ -1937,6 +1954,10 @@ var Host = class {
|
|
|
1937
1954
|
if (this.sshKey && V(this.sshKey).isA(SecretRef)) {
|
|
1938
1955
|
sshKeyForYaml = this.sshKey.toYAML();
|
|
1939
1956
|
}
|
|
1957
|
+
let sshKeyPassphraseForYaml = this.sshKeyPassphrase;
|
|
1958
|
+
if (this.sshKeyPassphrase && V(this.sshKeyPassphrase).isA(SecretRef)) {
|
|
1959
|
+
sshKeyPassphraseForYaml = this.sshKeyPassphrase.toYAML();
|
|
1960
|
+
}
|
|
1940
1961
|
return {
|
|
1941
1962
|
host: this.hostname,
|
|
1942
1963
|
// Always include the host field
|
|
@@ -1945,6 +1966,7 @@ var Host = class {
|
|
|
1945
1966
|
// Only include port if not default
|
|
1946
1967
|
password: passwordForYaml,
|
|
1947
1968
|
"ssh-key": sshKeyForYaml,
|
|
1969
|
+
"ssh-key-passphrase": sshKeyPassphraseForYaml,
|
|
1948
1970
|
tags: this.tags
|
|
1949
1971
|
};
|
|
1950
1972
|
}
|
|
@@ -2296,6 +2318,7 @@ var ConfigFile2 = class {
|
|
|
2296
2318
|
hostObj ||= {};
|
|
2297
2319
|
const password = this.parseSecretValue(hostObj.password);
|
|
2298
2320
|
const sshKey = this.parseSecretValue(hostObj["ssh-key"]);
|
|
2321
|
+
const sshKeyPassphrase = this.parseSecretValue(hostObj["ssh-key-passphrase"]);
|
|
2299
2322
|
const hostname = hostObj.host || alias;
|
|
2300
2323
|
hostMap.set(
|
|
2301
2324
|
alias,
|
|
@@ -2310,6 +2333,7 @@ var ConfigFile2 = class {
|
|
|
2310
2333
|
user: hostObj.user,
|
|
2311
2334
|
password,
|
|
2312
2335
|
sshKey,
|
|
2336
|
+
sshKeyPassphrase,
|
|
2313
2337
|
tags: hostObj.tags
|
|
2314
2338
|
})
|
|
2315
2339
|
);
|
|
@@ -2484,6 +2508,7 @@ var ProviderConfig = class _ProviderConfig {
|
|
|
2484
2508
|
user: input.user,
|
|
2485
2509
|
password: input.password,
|
|
2486
2510
|
sshKey: input.sshKey,
|
|
2511
|
+
sshKeyPassphrase: input.sshKeyPassphrase,
|
|
2487
2512
|
tags: input.tags
|
|
2488
2513
|
});
|
|
2489
2514
|
}
|
|
@@ -2527,6 +2552,7 @@ var FileConfigProvider = class {
|
|
|
2527
2552
|
port: h.port,
|
|
2528
2553
|
password: h.password,
|
|
2529
2554
|
sshKey: h.sshKey,
|
|
2555
|
+
sshKeyPassphrase: h.sshKeyPassphrase,
|
|
2530
2556
|
tags: h.tags
|
|
2531
2557
|
}));
|
|
2532
2558
|
}
|
|
@@ -2929,9 +2955,13 @@ function task(runFn4, options) {
|
|
|
2929
2955
|
options?.outputSchema
|
|
2930
2956
|
);
|
|
2931
2957
|
const taskFnObject = function(params) {
|
|
2932
|
-
|
|
2933
|
-
|
|
2958
|
+
const normalizedParams = params ?? {};
|
|
2959
|
+
const taskPartialFn = function(parentInvocation) {
|
|
2960
|
+
return parentInvocation.invokeChildTask(taskFnObject, normalizedParams);
|
|
2934
2961
|
};
|
|
2962
|
+
taskPartialFn.taskFn = taskFnObject;
|
|
2963
|
+
taskPartialFn.params = normalizedParams;
|
|
2964
|
+
return taskPartialFn;
|
|
2935
2965
|
};
|
|
2936
2966
|
Object.assign(taskFnObject, { task: taskInstance });
|
|
2937
2967
|
return taskFnObject;
|
|
@@ -3041,6 +3071,7 @@ var Invocation = class {
|
|
|
3041
3071
|
// src/remote-runtime.ts
|
|
3042
3072
|
import Handlebars2 from "handlebars";
|
|
3043
3073
|
import "path";
|
|
3074
|
+
import * as fs5 from "fs";
|
|
3044
3075
|
|
|
3045
3076
|
// src/ssh-session.ts
|
|
3046
3077
|
import { signalsByName } from "human-signals";
|
|
@@ -3224,6 +3255,15 @@ function withSudo(password, existingInputMap = {}) {
|
|
|
3224
3255
|
}
|
|
3225
3256
|
|
|
3226
3257
|
// src/remote-runtime.ts
|
|
3258
|
+
function normalizePrivateKey(value) {
|
|
3259
|
+
if (!value.includes("\n") && value.includes("\\n")) {
|
|
3260
|
+
return value.replace(/\\n/g, "\n");
|
|
3261
|
+
}
|
|
3262
|
+
return value;
|
|
3263
|
+
}
|
|
3264
|
+
function looksLikePrivateKey(value) {
|
|
3265
|
+
return /-----BEGIN [A-Z0-9 ]+PRIVATE KEY-----/.test(value);
|
|
3266
|
+
}
|
|
3227
3267
|
function normalizeWriteMode(mode) {
|
|
3228
3268
|
if (mode === void 0) {
|
|
3229
3269
|
return void 0;
|
|
@@ -3463,9 +3503,28 @@ var RemoteRuntime = class {
|
|
|
3463
3503
|
// Assuming defaultSshUser on App
|
|
3464
3504
|
port: this.host.port,
|
|
3465
3505
|
// node-ssh parses port from host string if present
|
|
3466
|
-
privateKey: await this.host.plaintextSshKeyPath(),
|
|
3467
3506
|
password: await this.host.decryptedPassword()
|
|
3468
3507
|
};
|
|
3508
|
+
const sshKeyPassphrase = await this.host.decryptedSshKeyPassphrase();
|
|
3509
|
+
if (sshKeyPassphrase) {
|
|
3510
|
+
sshConnectOpts.passphrase = sshKeyPassphrase;
|
|
3511
|
+
}
|
|
3512
|
+
const decryptedKey = await this.host.decryptedSshKey();
|
|
3513
|
+
if (decryptedKey) {
|
|
3514
|
+
const normalizedKey = normalizePrivateKey(decryptedKey).trim();
|
|
3515
|
+
if (looksLikePrivateKey(normalizedKey)) {
|
|
3516
|
+
sshConnectOpts.privateKey = normalizedKey;
|
|
3517
|
+
} else if (fs5.existsSync(normalizedKey)) {
|
|
3518
|
+
sshConnectOpts.privateKeyPath = normalizedKey;
|
|
3519
|
+
} else {
|
|
3520
|
+
sshConnectOpts.privateKey = normalizedKey;
|
|
3521
|
+
}
|
|
3522
|
+
} else {
|
|
3523
|
+
const keyPath = await this.host.plaintextSshKeyPath();
|
|
3524
|
+
if (keyPath) {
|
|
3525
|
+
sshConnectOpts.privateKeyPath = keyPath;
|
|
3526
|
+
}
|
|
3527
|
+
}
|
|
3469
3528
|
try {
|
|
3470
3529
|
if (!this.sshSession.isConnected()) {
|
|
3471
3530
|
await this.sshSession.connect(sshConnectOpts);
|
|
@@ -3556,7 +3615,7 @@ var RemoteRuntime = class {
|
|
|
3556
3615
|
};
|
|
3557
3616
|
|
|
3558
3617
|
// src/local-runtime.ts
|
|
3559
|
-
import * as
|
|
3618
|
+
import * as fs6 from "fs";
|
|
3560
3619
|
|
|
3561
3620
|
// src/ruspty-command.ts
|
|
3562
3621
|
import { Pty } from "@replit/ruspty";
|
|
@@ -3636,7 +3695,7 @@ var LocalInvocation = class _LocalInvocation extends Invocation {
|
|
|
3636
3695
|
)(params);
|
|
3637
3696
|
this.config = this.runtime.app.config;
|
|
3638
3697
|
this.file = {
|
|
3639
|
-
read: async (path14) =>
|
|
3698
|
+
read: async (path14) => fs6.promises.readFile(path14, "utf-8"),
|
|
3640
3699
|
write: async (path14, content, options) => {
|
|
3641
3700
|
const mode = normalizeMode(options?.mode);
|
|
3642
3701
|
const writeOptions = {
|
|
@@ -3645,20 +3704,20 @@ var LocalInvocation = class _LocalInvocation extends Invocation {
|
|
|
3645
3704
|
if (mode !== void 0) {
|
|
3646
3705
|
writeOptions.mode = mode;
|
|
3647
3706
|
}
|
|
3648
|
-
await
|
|
3707
|
+
await fs6.promises.writeFile(path14, content, writeOptions);
|
|
3649
3708
|
},
|
|
3650
3709
|
exists: async (path14) => {
|
|
3651
3710
|
try {
|
|
3652
|
-
await
|
|
3711
|
+
await fs6.promises.access(path14);
|
|
3653
3712
|
return true;
|
|
3654
3713
|
} catch {
|
|
3655
3714
|
return false;
|
|
3656
3715
|
}
|
|
3657
3716
|
},
|
|
3658
3717
|
mkdir: async (path14, options) => {
|
|
3659
|
-
await
|
|
3718
|
+
await fs6.promises.mkdir(path14, options);
|
|
3660
3719
|
},
|
|
3661
|
-
rm: async (path14, options) =>
|
|
3720
|
+
rm: async (path14, options) => fs6.promises.rm(path14, options)
|
|
3662
3721
|
};
|
|
3663
3722
|
}
|
|
3664
3723
|
config;
|
|
@@ -3897,6 +3956,9 @@ import AdmZip from "adm-zip";
|
|
|
3897
3956
|
|
|
3898
3957
|
// src/hash.ts
|
|
3899
3958
|
import { createHash } from "crypto";
|
|
3959
|
+
function sha256(str) {
|
|
3960
|
+
return createHash("sha256").update(str).digest("hex");
|
|
3961
|
+
}
|
|
3900
3962
|
|
|
3901
3963
|
// src/param-map.ts
|
|
3902
3964
|
import { match as match2 } from "ts-pattern";
|
|
@@ -3981,7 +4043,7 @@ var ParamMap = class _ParamMap {
|
|
|
3981
4043
|
import * as z from "zod";
|
|
3982
4044
|
|
|
3983
4045
|
// src/version.ts
|
|
3984
|
-
var version = "0.1.
|
|
4046
|
+
var version = "0.1.59";
|
|
3985
4047
|
|
|
3986
4048
|
// src/app.ts
|
|
3987
4049
|
import { retryUntilDefined } from "ts-retry";
|
|
@@ -4047,7 +4109,7 @@ var runAllRemote_default = task(run, {
|
|
|
4047
4109
|
});
|
|
4048
4110
|
|
|
4049
4111
|
// src/commands/pkg/package-manager.ts
|
|
4050
|
-
import { promises as
|
|
4112
|
+
import { promises as fs7 } from "fs";
|
|
4051
4113
|
|
|
4052
4114
|
// src/node-runtime.ts
|
|
4053
4115
|
import os3 from "os";
|
|
@@ -4298,7 +4360,7 @@ var PackageManager = class {
|
|
|
4298
4360
|
async loadManifest() {
|
|
4299
4361
|
try {
|
|
4300
4362
|
if (await this.manifestPath.exists()) {
|
|
4301
|
-
const manifestContent = await
|
|
4363
|
+
const manifestContent = await fs7.readFile(this.manifestPath.toString(), "utf-8");
|
|
4302
4364
|
this.manifest = JSON.parse(manifestContent);
|
|
4303
4365
|
} else {
|
|
4304
4366
|
this.manifest = { packages: [], version: "1.0" };
|
|
@@ -4311,7 +4373,7 @@ var PackageManager = class {
|
|
|
4311
4373
|
}
|
|
4312
4374
|
}
|
|
4313
4375
|
async saveManifest() {
|
|
4314
|
-
await
|
|
4376
|
+
await fs7.writeFile(this.manifestPath.toString(), JSON.stringify(this.manifest, null, 2));
|
|
4315
4377
|
}
|
|
4316
4378
|
isLocalPath(source) {
|
|
4317
4379
|
if (source.startsWith("file:")) {
|
|
@@ -4346,7 +4408,7 @@ var PackageManager = class {
|
|
|
4346
4408
|
async discoverTasks(packagePath) {
|
|
4347
4409
|
const tasks = [];
|
|
4348
4410
|
try {
|
|
4349
|
-
const entries = await
|
|
4411
|
+
const entries = await fs7.readdir(packagePath.toString(), { withFileTypes: true });
|
|
4350
4412
|
for (const entry of entries) {
|
|
4351
4413
|
if (entry.isFile() && (entry.name.endsWith(".ts") || entry.name.endsWith(".js"))) {
|
|
4352
4414
|
if (entry.name === "index.ts" || entry.name === "index.js") {
|
|
@@ -4364,7 +4426,7 @@ var PackageManager = class {
|
|
|
4364
4426
|
for (const subdir of subdirs) {
|
|
4365
4427
|
const subdirPath = packagePath.join(subdir);
|
|
4366
4428
|
if (await subdirPath.exists()) {
|
|
4367
|
-
const subEntries = await
|
|
4429
|
+
const subEntries = await fs7.readdir(subdirPath.toString(), { withFileTypes: true });
|
|
4368
4430
|
for (const entry of subEntries) {
|
|
4369
4431
|
if (entry.isFile() && (entry.name.endsWith(".ts") || entry.name.endsWith(".js"))) {
|
|
4370
4432
|
const taskPath = subdirPath.join(entry.name);
|
|
@@ -4554,7 +4616,7 @@ var PackageManager = class {
|
|
|
4554
4616
|
}
|
|
4555
4617
|
const normalizedSource = this.normalizeSource(source);
|
|
4556
4618
|
const packagesDir = this.app.packagesDir();
|
|
4557
|
-
await
|
|
4619
|
+
await fs7.mkdir(packagesDir.toString(), { recursive: true });
|
|
4558
4620
|
const filenamifiedSource = filenamify(normalizedSource, { replacement: "_" });
|
|
4559
4621
|
const installDir = packagesDir.join(filenamifiedSource);
|
|
4560
4622
|
const existingPackage = this.findPackageBySource(normalizedSource);
|
|
@@ -4646,7 +4708,7 @@ var PackageManager = class {
|
|
|
4646
4708
|
const overrideValue = hostctlOverride ? hostctlOverride.startsWith("file:") ? hostctlOverride : `file:${Path.new(hostctlOverride).absolute().toString()}` : void 0;
|
|
4647
4709
|
let packageJson;
|
|
4648
4710
|
if (await packageJsonPath.exists()) {
|
|
4649
|
-
const raw = await
|
|
4711
|
+
const raw = await fs7.readFile(packageJsonPath.toString(), "utf-8");
|
|
4650
4712
|
packageJson = JSON.parse(raw);
|
|
4651
4713
|
} else {
|
|
4652
4714
|
packageJson = {
|
|
@@ -4659,7 +4721,7 @@ var PackageManager = class {
|
|
|
4659
4721
|
if (overrideValue) {
|
|
4660
4722
|
packageJson.overrides = { ...packageJson.overrides ?? {}, hostctl: overrideValue };
|
|
4661
4723
|
}
|
|
4662
|
-
await
|
|
4724
|
+
await fs7.writeFile(packageJsonPath.toString(), JSON.stringify(packageJson, null, 2));
|
|
4663
4725
|
}
|
|
4664
4726
|
// Scan node_modules for the real installed package (by name or repo match)
|
|
4665
4727
|
async findRealInstalledNpmPackagePath(packagesDir, source) {
|
|
@@ -4670,14 +4732,14 @@ var PackageManager = class {
|
|
|
4670
4732
|
}
|
|
4671
4733
|
return { path: null, name: null };
|
|
4672
4734
|
}
|
|
4673
|
-
const entries = await
|
|
4735
|
+
const entries = await fs7.readdir(nodeModulesPath.toString());
|
|
4674
4736
|
for (const entry of entries) {
|
|
4675
4737
|
const potentialPackagePath = nodeModulesPath.join(entry);
|
|
4676
4738
|
if (await potentialPackagePath.isDirectory()) {
|
|
4677
4739
|
const packageJsonPath = potentialPackagePath.join("package.json");
|
|
4678
4740
|
if (await packageJsonPath.exists()) {
|
|
4679
4741
|
try {
|
|
4680
|
-
const packageJsonContent = await
|
|
4742
|
+
const packageJsonContent = await fs7.readFile(packageJsonPath.toString(), "utf-8");
|
|
4681
4743
|
const packageJson = JSON.parse(packageJsonContent);
|
|
4682
4744
|
if (packageJson.repository && typeof packageJson.repository.url === "string" && packageJson.repository.url.includes(source.replace(/^https?:\/\//, "").replace(/\.git$/, "")) || packageJson.homepage && packageJson.homepage.includes(source.replace(/^https?:\/\//, "").replace(/\.git$/, ""))) {
|
|
4683
4745
|
return { path: potentialPackagePath, name: packageJson.name };
|
|
@@ -4696,7 +4758,7 @@ var PackageManager = class {
|
|
|
4696
4758
|
const packageJsonPath = potentialPackagePath.join("package.json");
|
|
4697
4759
|
if (await packageJsonPath.exists()) {
|
|
4698
4760
|
try {
|
|
4699
|
-
const packageJsonContent = await
|
|
4761
|
+
const packageJsonContent = await fs7.readFile(packageJsonPath.toString(), "utf-8");
|
|
4700
4762
|
const packageJson = JSON.parse(packageJsonContent);
|
|
4701
4763
|
return { path: potentialPackagePath, name: packageJson.name };
|
|
4702
4764
|
} catch {
|
|
@@ -4736,7 +4798,7 @@ var PackageManager = class {
|
|
|
4736
4798
|
try {
|
|
4737
4799
|
const packageJsonPath = packagePath.join("package.json");
|
|
4738
4800
|
if (await packageJsonPath.exists()) {
|
|
4739
|
-
const packageJsonContent = await
|
|
4801
|
+
const packageJsonContent = await fs7.readFile(packageJsonPath.toString(), "utf-8");
|
|
4740
4802
|
const packageJson = JSON.parse(packageJsonContent);
|
|
4741
4803
|
return {
|
|
4742
4804
|
name: packageJson.name || fallbackName || packagePath.basename().toString(),
|
|
@@ -4753,7 +4815,7 @@ var PackageManager = class {
|
|
|
4753
4815
|
};
|
|
4754
4816
|
|
|
4755
4817
|
// src/task-registry-loader.ts
|
|
4756
|
-
import { promises as
|
|
4818
|
+
import { promises as fs8 } from "fs";
|
|
4757
4819
|
import path4 from "path";
|
|
4758
4820
|
import { pathToFileURL } from "url";
|
|
4759
4821
|
function resolveExportsEntry(exportsField) {
|
|
@@ -4771,7 +4833,7 @@ function resolveExportsEntry(exportsField) {
|
|
|
4771
4833
|
async function readPackageJson(packagePath) {
|
|
4772
4834
|
const packageJsonPath = path4.join(packagePath, "package.json");
|
|
4773
4835
|
try {
|
|
4774
|
-
const raw = await
|
|
4836
|
+
const raw = await fs8.readFile(packageJsonPath, "utf8");
|
|
4775
4837
|
return JSON.parse(raw);
|
|
4776
4838
|
} catch {
|
|
4777
4839
|
return null;
|
|
@@ -4779,7 +4841,7 @@ async function readPackageJson(packagePath) {
|
|
|
4779
4841
|
}
|
|
4780
4842
|
async function fileExists(filePath) {
|
|
4781
4843
|
try {
|
|
4782
|
-
const stat = await
|
|
4844
|
+
const stat = await fs8.stat(filePath);
|
|
4783
4845
|
return stat.isFile();
|
|
4784
4846
|
} catch {
|
|
4785
4847
|
return false;
|
|
@@ -5385,7 +5447,7 @@ var DirCreateOutputSchema = z.object({
|
|
|
5385
5447
|
})
|
|
5386
5448
|
);
|
|
5387
5449
|
async function runFn(context) {
|
|
5388
|
-
const { params, exec, run:
|
|
5450
|
+
const { params, exec, run: run249 } = context;
|
|
5389
5451
|
const sudoDefault = context.host ? !context.host.isLocal() : false;
|
|
5390
5452
|
const { path: path14, mode, owner, sudo = sudoDefault } = params;
|
|
5391
5453
|
if (!path14) {
|
|
@@ -5409,7 +5471,7 @@ async function runFn(context) {
|
|
|
5409
5471
|
}
|
|
5410
5472
|
}
|
|
5411
5473
|
if (mode) {
|
|
5412
|
-
const chmodResult = await
|
|
5474
|
+
const chmodResult = await run249(chmod_default({ path: path14, mode, sudo: true }));
|
|
5413
5475
|
if (!chmodResult?.success) {
|
|
5414
5476
|
return { success: false, error: chmodResult?.error ?? "Failed to set directory mode" };
|
|
5415
5477
|
}
|
|
@@ -6002,7 +6064,7 @@ async function ensureFile(context, file, sudo) {
|
|
|
6002
6064
|
await exec(["touch", file], { sudo });
|
|
6003
6065
|
}
|
|
6004
6066
|
async function runFn2(context) {
|
|
6005
|
-
const { params, exec, info, run:
|
|
6067
|
+
const { params, exec, info, run: run249, error } = context;
|
|
6006
6068
|
const {
|
|
6007
6069
|
file,
|
|
6008
6070
|
state = "present",
|
|
@@ -6689,7 +6751,7 @@ async function getOsReleaseInfo(exec) {
|
|
|
6689
6751
|
const cpeMatch = osRelease.match(/^CPE_NAME=(.*?)$/im);
|
|
6690
6752
|
if (idMatch) {
|
|
6691
6753
|
let id = idMatch[1].trim().replace(/"/g, "");
|
|
6692
|
-
|
|
6754
|
+
let idLike = idLikeMatch ? idLikeMatch[1].trim().replace(/"/g, "") : id;
|
|
6693
6755
|
const version2 = versionIdMatch && versionIdMatch[1].trim().replace(/"/g, "") || buildIdMatch && buildIdMatch[1].trim().replace(/"/g, "") || "unknown";
|
|
6694
6756
|
const nameValue = nameMatch ? nameMatch[1].trim().replace(/"/g, "") : "";
|
|
6695
6757
|
const prettyName = prettyNameMatch ? prettyNameMatch[1].trim().replace(/"/g, "") : "";
|
|
@@ -6698,6 +6760,10 @@ async function getOsReleaseInfo(exec) {
|
|
|
6698
6760
|
if (normalizedName.includes("rocky") || idLike.toLowerCase().includes("rocky")) {
|
|
6699
6761
|
id = "rocky";
|
|
6700
6762
|
}
|
|
6763
|
+
if (normalizedName.includes("xcp-ng") || id.toLowerCase() === "xenenterprise") {
|
|
6764
|
+
id = "xcp-ng";
|
|
6765
|
+
idLike = "xcp-ng";
|
|
6766
|
+
}
|
|
6701
6767
|
return {
|
|
6702
6768
|
idLike,
|
|
6703
6769
|
id,
|
|
@@ -6717,6 +6783,53 @@ async function getOsReleaseInfo(exec) {
|
|
|
6717
6783
|
};
|
|
6718
6784
|
}
|
|
6719
6785
|
}
|
|
6786
|
+
function parseKeyValueFile(contents) {
|
|
6787
|
+
return contents.split("\n").map((line) => line.trim()).filter(Boolean).reduce((acc, line) => {
|
|
6788
|
+
const match7 = line.match(/^([A-Za-z0-9_]+)=(.*)$/);
|
|
6789
|
+
if (!match7) {
|
|
6790
|
+
return acc;
|
|
6791
|
+
}
|
|
6792
|
+
const key = match7[1];
|
|
6793
|
+
const rawValue = match7[2];
|
|
6794
|
+
const value = rawValue.replace(/^"(.*)"$/, "$1");
|
|
6795
|
+
acc[key] = value;
|
|
6796
|
+
return acc;
|
|
6797
|
+
}, {});
|
|
6798
|
+
}
|
|
6799
|
+
async function detectSynologyInfo(exec) {
|
|
6800
|
+
try {
|
|
6801
|
+
const { stdout } = await exec(["cat", "/etc.defaults/VERSION"]);
|
|
6802
|
+
const values3 = parseKeyValueFile(stdout);
|
|
6803
|
+
const version2 = values3.productversion || values3.version || `${values3.major || ""}.${values3.minor || ""}`.trim();
|
|
6804
|
+
if (!version2 || version2 === ".") {
|
|
6805
|
+
return null;
|
|
6806
|
+
}
|
|
6807
|
+
return {
|
|
6808
|
+
idLike: "synology",
|
|
6809
|
+
id: "synology",
|
|
6810
|
+
version: version2
|
|
6811
|
+
};
|
|
6812
|
+
} catch {
|
|
6813
|
+
return null;
|
|
6814
|
+
}
|
|
6815
|
+
}
|
|
6816
|
+
async function detectXcpNgInfo(exec) {
|
|
6817
|
+
try {
|
|
6818
|
+
const { stdout } = await exec(["cat", "/etc/redhat-release"]);
|
|
6819
|
+
if (!stdout.toLowerCase().includes("xcp-ng")) {
|
|
6820
|
+
return null;
|
|
6821
|
+
}
|
|
6822
|
+
const versionMatch = stdout.match(/([0-9]+(?:\.[0-9]+)+)/);
|
|
6823
|
+
const version2 = versionMatch ? versionMatch[1] : "unknown";
|
|
6824
|
+
return {
|
|
6825
|
+
idLike: "xcp-ng",
|
|
6826
|
+
id: "xcp-ng",
|
|
6827
|
+
version: version2
|
|
6828
|
+
};
|
|
6829
|
+
} catch {
|
|
6830
|
+
return null;
|
|
6831
|
+
}
|
|
6832
|
+
}
|
|
6720
6833
|
async function detectRockyLinux(exec) {
|
|
6721
6834
|
try {
|
|
6722
6835
|
const { stdout } = await exec([
|
|
@@ -6731,58 +6844,74 @@ async function detectRockyLinux(exec) {
|
|
|
6731
6844
|
}
|
|
6732
6845
|
var os_default = task(
|
|
6733
6846
|
async function run27(context) {
|
|
6734
|
-
|
|
6735
|
-
|
|
6736
|
-
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
6756
|
-
|
|
6757
|
-
|
|
6758
|
-
|
|
6759
|
-
|
|
6760
|
-
|
|
6761
|
-
|
|
6762
|
-
|
|
6763
|
-
|
|
6764
|
-
|
|
6765
|
-
|
|
6766
|
-
|
|
6847
|
+
return await context.memoize(
|
|
6848
|
+
"core.host.os:v1",
|
|
6849
|
+
async () => {
|
|
6850
|
+
try {
|
|
6851
|
+
const { exec } = context;
|
|
6852
|
+
const {
|
|
6853
|
+
success: ostypeSuccess,
|
|
6854
|
+
stdout: ostypeOutput,
|
|
6855
|
+
stderr: ostypeStderr
|
|
6856
|
+
} = await exec(["bash", "-c", "echo $OSTYPE"]);
|
|
6857
|
+
if (!ostypeSuccess) {
|
|
6858
|
+
throw new Error(`Failed to get OSTYPE: ${ostypeStderr}`);
|
|
6859
|
+
}
|
|
6860
|
+
const family = await match5(ostypeOutput.trim().toLowerCase()).with(P3.string.startsWith("solaris"), () => "solaris").with(P3.string.startsWith("darwin"), () => "darwin").with(P3.string.startsWith("linux"), () => "linux").with(P3.string.startsWith("bsd"), () => "bsd").with(P3.string.startsWith("freebsd"), () => "bsd").with(P3.string.startsWith("msys"), () => "windows").with(P3.string.startsWith("cygwin"), () => "windows").with(P3.string.startsWith("mingw"), () => "windows").otherwise(async () => {
|
|
6861
|
+
const { stdout: unameOutput } = await exec(["uname"]);
|
|
6862
|
+
const unameFamily = match5(unameOutput.trim().toLowerCase()).with(P3.string.startsWith("sunos"), () => "solaris").with(P3.string.startsWith("darwin"), () => "darwin").with(P3.string.startsWith("linux"), () => "linux").with(P3.string.startsWith("freebsd"), () => "bsd").with(P3.string.startsWith("openbsd"), () => "bsd").with(P3.string.startsWith("netbsd"), () => "bsd").otherwise(() => "unknown");
|
|
6863
|
+
return unameFamily;
|
|
6864
|
+
});
|
|
6865
|
+
const [osIdLike, osId, osVersion] = await match5(family).with("bsd", async () => {
|
|
6866
|
+
const { stdout: unameROutput } = await exec(["uname", "-r"]);
|
|
6867
|
+
return [family, family, unameROutput.trim()];
|
|
6868
|
+
}).with("darwin", async () => {
|
|
6869
|
+
const { stdout: swVersOutput } = await exec(["sw_vers", "-productVersion"]);
|
|
6870
|
+
return [family, family, swVersOutput.trim()];
|
|
6871
|
+
}).with("linux", async () => {
|
|
6872
|
+
let { idLike, id, version: version2 } = await getOsReleaseInfo(exec);
|
|
6873
|
+
if (id === "unknown") {
|
|
6874
|
+
const synologyInfo = await detectSynologyInfo(exec);
|
|
6875
|
+
if (synologyInfo) {
|
|
6876
|
+
return [synologyInfo.idLike, synologyInfo.id, synologyInfo.version];
|
|
6877
|
+
}
|
|
6878
|
+
const xcpNgInfo = await detectXcpNgInfo(exec);
|
|
6879
|
+
if (xcpNgInfo) {
|
|
6880
|
+
return [xcpNgInfo.idLike, xcpNgInfo.id, xcpNgInfo.version];
|
|
6881
|
+
}
|
|
6882
|
+
}
|
|
6883
|
+
return [idLike, id, version2];
|
|
6884
|
+
}).with("solaris", async () => {
|
|
6885
|
+
const { stdout: unameROutput } = await exec(["uname", "-r"]);
|
|
6886
|
+
return ["solaris", "solaris", unameROutput.trim()];
|
|
6887
|
+
}).with("windows", () => ["windows", "windows", "unknown"]).otherwise(() => ["unknown", "unknown", "unknown"]);
|
|
6888
|
+
let variant = osId.toLowerCase();
|
|
6889
|
+
if (family === "linux" && !variant.includes("rocky") && (osIdLike.toLowerCase().includes("rocky") || osId.toLowerCase().includes("rhel"))) {
|
|
6890
|
+
const isRocky = await detectRockyLinux(exec);
|
|
6891
|
+
if (isRocky) {
|
|
6892
|
+
variant = "rocky";
|
|
6893
|
+
}
|
|
6894
|
+
}
|
|
6895
|
+
return {
|
|
6896
|
+
success: true,
|
|
6897
|
+
family,
|
|
6898
|
+
os: osIdLike.toLowerCase(),
|
|
6899
|
+
variant,
|
|
6900
|
+
version: osVersion
|
|
6901
|
+
};
|
|
6902
|
+
} catch (error) {
|
|
6903
|
+
return {
|
|
6904
|
+
success: false,
|
|
6905
|
+
error: error.message,
|
|
6906
|
+
family: "unknown",
|
|
6907
|
+
os: "unknown",
|
|
6908
|
+
variant: "unknown",
|
|
6909
|
+
version: "unknown"
|
|
6910
|
+
};
|
|
6767
6911
|
}
|
|
6768
|
-
}
|
|
6769
|
-
|
|
6770
|
-
|
|
6771
|
-
family,
|
|
6772
|
-
os: osIdLike.toLowerCase(),
|
|
6773
|
-
variant,
|
|
6774
|
-
version: osVersion
|
|
6775
|
-
};
|
|
6776
|
-
} catch (error) {
|
|
6777
|
-
return {
|
|
6778
|
-
success: false,
|
|
6779
|
-
error: error.message,
|
|
6780
|
-
family: "unknown",
|
|
6781
|
-
os: "unknown",
|
|
6782
|
-
variant: "unknown",
|
|
6783
|
-
version: "unknown"
|
|
6784
|
-
};
|
|
6785
|
-
}
|
|
6912
|
+
},
|
|
6913
|
+
{ scope: "host" }
|
|
6914
|
+
);
|
|
6786
6915
|
},
|
|
6787
6916
|
{
|
|
6788
6917
|
name: "os",
|
|
@@ -6833,15 +6962,29 @@ async function run28(context) {
|
|
|
6833
6962
|
const hostnameResult = await runTask(hostname_default({}));
|
|
6834
6963
|
const name = hostnameResult.hostname;
|
|
6835
6964
|
const os6 = await runTask(os_default({}));
|
|
6836
|
-
|
|
6837
|
-
|
|
6838
|
-
|
|
6839
|
-
|
|
6840
|
-
|
|
6841
|
-
|
|
6842
|
-
|
|
6843
|
-
|
|
6844
|
-
|
|
6965
|
+
let lsb_release = {
|
|
6966
|
+
"Distributor ID": "",
|
|
6967
|
+
Description: "",
|
|
6968
|
+
Release: "",
|
|
6969
|
+
Codename: ""
|
|
6970
|
+
};
|
|
6971
|
+
try {
|
|
6972
|
+
const { stdout: lsbOutput } = await exec(["lsb_release", "-a"]);
|
|
6973
|
+
lsb_release = lsbOutput.split("\n").filter(Boolean).reduce((acc, line) => {
|
|
6974
|
+
const [key, ...valueParts] = line.split(":");
|
|
6975
|
+
const value = valueParts.join(":").trim();
|
|
6976
|
+
acc[key.trim()] = value;
|
|
6977
|
+
return acc;
|
|
6978
|
+
}, {});
|
|
6979
|
+
} catch {
|
|
6980
|
+
}
|
|
6981
|
+
let lscpu = [];
|
|
6982
|
+
try {
|
|
6983
|
+
const { stdout: lscpuOutput } = await exec(["lscpu", "-J"]);
|
|
6984
|
+
const parsed = JSON.parse(lscpuOutput);
|
|
6985
|
+
lscpu = Array.isArray(parsed?.lscpu) ? parsed.lscpu : [];
|
|
6986
|
+
} catch {
|
|
6987
|
+
}
|
|
6845
6988
|
return {
|
|
6846
6989
|
host: {
|
|
6847
6990
|
name,
|
|
@@ -8190,10 +8333,6 @@ var uninstall_default2 = task(run42, {
|
|
|
8190
8333
|
// src/core/pkg/dnf/update.ts
|
|
8191
8334
|
async function run43(context) {
|
|
8192
8335
|
const { sudo = true, updateMetadata = true } = context.params;
|
|
8193
|
-
const isProtectedPackageError = (output) => {
|
|
8194
|
-
const normalized = output.toLowerCase();
|
|
8195
|
-
return normalized.includes("protected packages") || normalized.includes("protected package") || normalized.includes("the following protected") || normalized.includes("systemd-udev");
|
|
8196
|
-
};
|
|
8197
8336
|
try {
|
|
8198
8337
|
if (!updateMetadata) {
|
|
8199
8338
|
return {
|
|
@@ -8204,55 +8343,25 @@ async function run43(context) {
|
|
|
8204
8343
|
updatedPackages: []
|
|
8205
8344
|
};
|
|
8206
8345
|
}
|
|
8207
|
-
const command = ["dnf", "
|
|
8346
|
+
const command = ["dnf", "makecache", "--refresh", "--quiet"];
|
|
8208
8347
|
const result = await context.exec(command, { sudo });
|
|
8209
|
-
const combinedOutput = `${result.stdout}
|
|
8210
|
-
${result.stderr}`;
|
|
8211
8348
|
if (result.exitCode === 0) {
|
|
8212
|
-
const updatedPackages = [];
|
|
8213
|
-
let packagesUpdated = 0;
|
|
8214
|
-
const lines = result.stdout.split("\n");
|
|
8215
|
-
for (const line of lines) {
|
|
8216
|
-
if (line.includes("packages upgraded")) {
|
|
8217
|
-
const match7 = line.match(/(\d+)\s+packages? upgraded/);
|
|
8218
|
-
if (match7) {
|
|
8219
|
-
packagesUpdated = parseInt(match7[1], 10);
|
|
8220
|
-
}
|
|
8221
|
-
} else if (line.includes("Installing") || line.includes("Upgrading")) {
|
|
8222
|
-
const match7 = line.match(/(?:Installing|Upgrading)\s+(\S+)/);
|
|
8223
|
-
if (match7) {
|
|
8224
|
-
updatedPackages.push(match7[1]);
|
|
8225
|
-
}
|
|
8226
|
-
}
|
|
8227
|
-
}
|
|
8228
8349
|
return {
|
|
8229
8350
|
success: true,
|
|
8230
8351
|
packageManager: "dnf",
|
|
8231
8352
|
output: result.stdout,
|
|
8232
|
-
packagesUpdated,
|
|
8233
|
-
updatedPackages
|
|
8234
|
-
};
|
|
8235
|
-
} else {
|
|
8236
|
-
if (isProtectedPackageError(combinedOutput)) {
|
|
8237
|
-
context.warn("DNF skipped updates because the transaction would remove protected packages.");
|
|
8238
|
-
return {
|
|
8239
|
-
success: true,
|
|
8240
|
-
packageManager: "dnf",
|
|
8241
|
-
output: combinedOutput,
|
|
8242
|
-
packagesUpdated: 0,
|
|
8243
|
-
updatedPackages: [],
|
|
8244
|
-
warning: "DNF skipped updates due to protected packages; leaving system unchanged."
|
|
8245
|
-
};
|
|
8246
|
-
}
|
|
8247
|
-
return {
|
|
8248
|
-
success: false,
|
|
8249
|
-
error: result.stderr || "Update failed",
|
|
8250
|
-
packageManager: "dnf",
|
|
8251
|
-
output: result.stdout,
|
|
8252
8353
|
packagesUpdated: 0,
|
|
8253
8354
|
updatedPackages: []
|
|
8254
8355
|
};
|
|
8255
8356
|
}
|
|
8357
|
+
return {
|
|
8358
|
+
success: false,
|
|
8359
|
+
error: result.stderr || "Update failed",
|
|
8360
|
+
packageManager: "dnf",
|
|
8361
|
+
output: result.stdout,
|
|
8362
|
+
packagesUpdated: 0,
|
|
8363
|
+
updatedPackages: []
|
|
8364
|
+
};
|
|
8256
8365
|
} catch (error) {
|
|
8257
8366
|
context.error("Error updating packages:", error);
|
|
8258
8367
|
return {
|
|
@@ -8266,7 +8375,7 @@ ${result.stderr}`;
|
|
|
8266
8375
|
}
|
|
8267
8376
|
var update_default2 = task(run43, {
|
|
8268
8377
|
name: "update",
|
|
8269
|
-
description: "Update
|
|
8378
|
+
description: "Update package metadata using dnf package manager",
|
|
8270
8379
|
inputSchema: DnfUpdateParamsSchema,
|
|
8271
8380
|
outputSchema: DnfUpdateResultSchema
|
|
8272
8381
|
});
|
|
@@ -10911,6 +11020,44 @@ async function packageManagerSpecificInstall(pkgManager, context) {
|
|
|
10911
11020
|
return abstractInstallFallback(context, pkgManager);
|
|
10912
11021
|
}
|
|
10913
11022
|
}
|
|
11023
|
+
async function packageManagerSpecificUpdate(pkgManager, context) {
|
|
11024
|
+
const mapAptParams = () => ({
|
|
11025
|
+
...context.params,
|
|
11026
|
+
packageManager: "apt",
|
|
11027
|
+
updateLists: true,
|
|
11028
|
+
upgrade: false
|
|
11029
|
+
});
|
|
11030
|
+
const mapDnfParams = () => ({
|
|
11031
|
+
...context.params,
|
|
11032
|
+
packageManager: "dnf",
|
|
11033
|
+
updateMetadata: true,
|
|
11034
|
+
upgrade: false
|
|
11035
|
+
});
|
|
11036
|
+
const mapPacmanParams = () => ({
|
|
11037
|
+
...context.params,
|
|
11038
|
+
packageManager: "pacman",
|
|
11039
|
+
updateMetadata: true,
|
|
11040
|
+
upgrade: false
|
|
11041
|
+
});
|
|
11042
|
+
const mapYumParams = () => ({
|
|
11043
|
+
...context.params,
|
|
11044
|
+
packageManager: "yum",
|
|
11045
|
+
updateMetadata: true,
|
|
11046
|
+
upgrade: false
|
|
11047
|
+
});
|
|
11048
|
+
switch (pkgManager.name) {
|
|
11049
|
+
case "apt":
|
|
11050
|
+
return await context.run(update_default(mapAptParams()));
|
|
11051
|
+
case "dnf":
|
|
11052
|
+
return await context.run(update_default2(mapDnfParams()));
|
|
11053
|
+
case "pacman":
|
|
11054
|
+
return await context.run(update_default3(mapPacmanParams()));
|
|
11055
|
+
case "yum":
|
|
11056
|
+
return await context.run(update_default4(mapYumParams()));
|
|
11057
|
+
default:
|
|
11058
|
+
return await abstractUpdateFallback(context, pkgManager);
|
|
11059
|
+
}
|
|
11060
|
+
}
|
|
10914
11061
|
function buildCommandArray(pkgManager, operation, packages, extraArgs) {
|
|
10915
11062
|
const baseCommand = pkgManager[operation];
|
|
10916
11063
|
if (!baseCommand) {
|
|
@@ -11200,8 +11347,8 @@ async function abstractUninstallFallback(context) {
|
|
|
11200
11347
|
}
|
|
11201
11348
|
}
|
|
11202
11349
|
async function abstractUpdate(context) {
|
|
11203
|
-
const { params,
|
|
11204
|
-
const {
|
|
11350
|
+
const { params, warn } = context;
|
|
11351
|
+
const { packageManager: forcedManager } = params;
|
|
11205
11352
|
try {
|
|
11206
11353
|
const pkgManager = forcedManager ? PACKAGE_MANAGERS[forcedManager] : await detectPackageManager(context);
|
|
11207
11354
|
if (!pkgManager) {
|
|
@@ -11211,14 +11358,26 @@ async function abstractUpdate(context) {
|
|
|
11211
11358
|
};
|
|
11212
11359
|
}
|
|
11213
11360
|
warn(`Using package manager: ${pkgManager.name}`);
|
|
11214
|
-
|
|
11215
|
-
|
|
11216
|
-
|
|
11217
|
-
|
|
11218
|
-
|
|
11219
|
-
|
|
11220
|
-
|
|
11361
|
+
return await packageManagerSpecificUpdate(pkgManager, context);
|
|
11362
|
+
} catch (error) {
|
|
11363
|
+
return {
|
|
11364
|
+
success: false,
|
|
11365
|
+
error: error instanceof Error ? error.message : String(error)
|
|
11366
|
+
};
|
|
11367
|
+
}
|
|
11368
|
+
}
|
|
11369
|
+
async function abstractUpdateFallback(context, detectedManager) {
|
|
11370
|
+
const { params, exec, warn, info } = context;
|
|
11371
|
+
const { sudo = true, packageManager: forcedManager, extraArgs, input: userInput } = params;
|
|
11372
|
+
try {
|
|
11373
|
+
const pkgManager = detectedManager || (forcedManager ? PACKAGE_MANAGERS[forcedManager] : await detectPackageManager(context));
|
|
11374
|
+
if (!pkgManager) {
|
|
11375
|
+
return {
|
|
11376
|
+
success: false,
|
|
11377
|
+
error: "No supported package manager detected. Please specify one explicitly."
|
|
11378
|
+
};
|
|
11221
11379
|
}
|
|
11380
|
+
warn(`Using fallback implementation for package manager: ${pkgManager.name}`);
|
|
11222
11381
|
const mergedInput = getInteractiveInput(pkgManager.name, userInput);
|
|
11223
11382
|
const commandArray = buildCommandArray(pkgManager, "updateCommand", [], extraArgs);
|
|
11224
11383
|
info(`Executing: ${commandArray.join(" ")}`);
|
|
@@ -11753,7 +11912,8 @@ async function abstractClean(context) {
|
|
|
11753
11912
|
var AbstractPkgUpdateParamsSchema = AbstractPkgParamsSchema.pick({
|
|
11754
11913
|
sudo: true,
|
|
11755
11914
|
packageManager: true,
|
|
11756
|
-
extraArgs: true
|
|
11915
|
+
extraArgs: true,
|
|
11916
|
+
input: true
|
|
11757
11917
|
});
|
|
11758
11918
|
var AbstractPkgUpdateResultSchema = AbstractPkgResultSchema;
|
|
11759
11919
|
async function run69(context) {
|
|
@@ -12134,7 +12294,6 @@ async function run76(context) {
|
|
|
12134
12294
|
const { params, run: runTask, exec, log, info, error } = context;
|
|
12135
12295
|
let { public_key, user, sudo } = params;
|
|
12136
12296
|
const publicKeyTrimmed = public_key.trim();
|
|
12137
|
-
const sudoPrefix = sudo ? ["sudo"] : [];
|
|
12138
12297
|
if (!user) {
|
|
12139
12298
|
const usernameResult = await runTask(get_username_default());
|
|
12140
12299
|
if (usernameResult instanceof Error) {
|
|
@@ -12188,9 +12347,7 @@ async function run76(context) {
|
|
|
12188
12347
|
);
|
|
12189
12348
|
return { success: false, changed: false };
|
|
12190
12349
|
}
|
|
12191
|
-
const
|
|
12192
|
-
checkKeyCommandParts.push("sudo", "-u", user, "grep", "-xqF", publicKeyTrimmed, authorizedKeysFile);
|
|
12193
|
-
const checkKeyCmdResult = await exec(checkKeyCommandParts);
|
|
12350
|
+
const checkKeyCmdResult = await exec(["grep", "-xqF", publicKeyTrimmed, authorizedKeysFile], { sudo });
|
|
12194
12351
|
if (checkKeyCmdResult.exitCode === 0) {
|
|
12195
12352
|
info(`SSH key already exists in ${authorizedKeysFile} for user ${user}.`);
|
|
12196
12353
|
return { success: true, changed: false };
|
|
@@ -12200,7 +12357,7 @@ async function run76(context) {
|
|
|
12200
12357
|
}
|
|
12201
12358
|
const escapedPublicKey = publicKeyTrimmed.replace(/"/g, '\\"').replace(/\$/g, "\\$").replace(/`/g, "\\`");
|
|
12202
12359
|
const command = `echo "${escapedPublicKey}" >> "${authorizedKeysFile}"`;
|
|
12203
|
-
const addKeyResult = await exec([
|
|
12360
|
+
const addKeyResult = await exec(["sh", "-c", command], { sudo });
|
|
12204
12361
|
if (!addKeyResult.success) {
|
|
12205
12362
|
error(`Failed to append public key to ${authorizedKeysFile}: ${addKeyResult.stderr}`);
|
|
12206
12363
|
return { success: false, changed: false };
|
|
@@ -12498,7 +12655,7 @@ async function bootstrapServiceAccount(context) {
|
|
|
12498
12655
|
create_home = true,
|
|
12499
12656
|
create_group = true,
|
|
12500
12657
|
system = false,
|
|
12501
|
-
skip_packages =
|
|
12658
|
+
skip_packages = true
|
|
12502
12659
|
} = params;
|
|
12503
12660
|
const skipPackages = typeof skip_packages === "string" ? skip_packages === "true" : Boolean(skip_packages);
|
|
12504
12661
|
if (!username || !password || !public_key) {
|
|
@@ -12751,7 +12908,6 @@ __export(pkg_exports, {
|
|
|
12751
12908
|
removeCp: () => remove_cp_default,
|
|
12752
12909
|
search: () => search_default5,
|
|
12753
12910
|
update: () => update_default5,
|
|
12754
|
-
updateCp: () => update_cp_default,
|
|
12755
12911
|
upgrade: () => upgrade_default5,
|
|
12756
12912
|
yum: () => yum_exports
|
|
12757
12913
|
});
|
|
@@ -13262,94 +13418,6 @@ var remove_default = task(run90, {
|
|
|
13262
13418
|
// src/core/pkg/remove-cp.ts
|
|
13263
13419
|
var remove_cp_default = remove_default;
|
|
13264
13420
|
|
|
13265
|
-
// src/core/pkg/update/arch.ts
|
|
13266
|
-
async function run91(context) {
|
|
13267
|
-
const {
|
|
13268
|
-
params: { package: pkg, sudo = true },
|
|
13269
|
-
exec
|
|
13270
|
-
} = context;
|
|
13271
|
-
const commandParts = [sudo ? "sudo" : "", "pacman", "-Syu", "--noconfirm"];
|
|
13272
|
-
if (pkg && Array.isArray(pkg) && pkg.length) {
|
|
13273
|
-
commandParts.push(...pkg);
|
|
13274
|
-
}
|
|
13275
|
-
const { success } = await exec(commandParts.filter(Boolean).join(" "), { sudo });
|
|
13276
|
-
return { success };
|
|
13277
|
-
}
|
|
13278
|
-
var update = task(run91);
|
|
13279
|
-
|
|
13280
|
-
// src/core/pkg/update/debian.ts
|
|
13281
|
-
async function run92(context) {
|
|
13282
|
-
const {
|
|
13283
|
-
params: { package: pkg, sudo = true, fullUpgrade = false },
|
|
13284
|
-
exec
|
|
13285
|
-
} = context;
|
|
13286
|
-
const prefix = sudo ? "sudo " : "";
|
|
13287
|
-
if (!pkg || Array.isArray(pkg) && pkg.length === 0) {
|
|
13288
|
-
const upgradeCmd = fullUpgrade ? "apt-get dist-upgrade -y" : "apt-get upgrade -y";
|
|
13289
|
-
const { success: u1 } = await exec(`${prefix}apt-get update`, { sudo });
|
|
13290
|
-
if (!u1) return { success: false };
|
|
13291
|
-
const { success: success2 } = await exec(prefix + upgradeCmd, { sudo });
|
|
13292
|
-
return { success: success2 };
|
|
13293
|
-
}
|
|
13294
|
-
const packages = Array.isArray(pkg) ? pkg : [pkg];
|
|
13295
|
-
const { success } = await exec(`${prefix}apt-get install -y --only-upgrade ${packages.join(" ")}`, { sudo });
|
|
13296
|
-
return { success };
|
|
13297
|
-
}
|
|
13298
|
-
var update2 = task(run92);
|
|
13299
|
-
|
|
13300
|
-
// src/core/pkg/update/fedora.ts
|
|
13301
|
-
async function run93(context) {
|
|
13302
|
-
const {
|
|
13303
|
-
params: { package: pkg, sudo = true },
|
|
13304
|
-
exec
|
|
13305
|
-
} = context;
|
|
13306
|
-
const prefix = sudo ? "sudo " : "";
|
|
13307
|
-
if (!pkg || Array.isArray(pkg) && pkg.length === 0) {
|
|
13308
|
-
const { success: success2 } = await exec(`${prefix}dnf upgrade -y`, { sudo });
|
|
13309
|
-
return { success: success2 };
|
|
13310
|
-
}
|
|
13311
|
-
const packages = Array.isArray(pkg) ? pkg : [pkg];
|
|
13312
|
-
const { success } = await exec(`${prefix}dnf upgrade -y ${packages.join(" ")}`, { sudo });
|
|
13313
|
-
return { success };
|
|
13314
|
-
}
|
|
13315
|
-
var update3 = task(run93);
|
|
13316
|
-
|
|
13317
|
-
// src/core/pkg/update/index.ts
|
|
13318
|
-
async function run94(context) {
|
|
13319
|
-
const { params: taskParams, run: runTask, error } = context;
|
|
13320
|
-
const osDetails = await runTask(os_default());
|
|
13321
|
-
if (osDetails instanceof Error) {
|
|
13322
|
-
error(`Failed to determine OS details: ${osDetails.message}`);
|
|
13323
|
-
return { success: false };
|
|
13324
|
-
}
|
|
13325
|
-
const baseOs = String(osDetails?.os ?? "");
|
|
13326
|
-
let result;
|
|
13327
|
-
if (/arch/.test(baseOs)) {
|
|
13328
|
-
result = await runTask(update(taskParams));
|
|
13329
|
-
} else if (/debian|ubuntu/.test(baseOs)) {
|
|
13330
|
-
result = await runTask(update2(taskParams));
|
|
13331
|
-
} else if (baseOs === "fedora") {
|
|
13332
|
-
result = await runTask(update3(taskParams));
|
|
13333
|
-
} else {
|
|
13334
|
-
error(`Unsupported OS (${baseOs}) for pkg.update`);
|
|
13335
|
-
return { success: false };
|
|
13336
|
-
}
|
|
13337
|
-
if (result instanceof Error) {
|
|
13338
|
-
error(`pkg.update failed: ${result.message}`);
|
|
13339
|
-
return { success: false };
|
|
13340
|
-
}
|
|
13341
|
-
return result;
|
|
13342
|
-
}
|
|
13343
|
-
var update_default6 = task(run94, {
|
|
13344
|
-
name: "update",
|
|
13345
|
-
description: "Updates packages using the appropriate OS package manager.",
|
|
13346
|
-
inputSchema: PkgUpdateParamsSchema,
|
|
13347
|
-
outputSchema: PkgUpdateResultSchema
|
|
13348
|
-
});
|
|
13349
|
-
|
|
13350
|
-
// src/core/pkg/update-cp.ts
|
|
13351
|
-
var update_cp_default = update_default6;
|
|
13352
|
-
|
|
13353
13421
|
// src/core/pkg/search.ts
|
|
13354
13422
|
var AbstractPkgSearchParamsSchema = z.object({
|
|
13355
13423
|
/** Search query */
|
|
@@ -13358,13 +13426,13 @@ var AbstractPkgSearchParamsSchema = z.object({
|
|
|
13358
13426
|
packageManager: z.string().optional()
|
|
13359
13427
|
});
|
|
13360
13428
|
var AbstractPkgSearchResultSchema = AbstractPkgResultSchema;
|
|
13361
|
-
async function
|
|
13429
|
+
async function run91(context) {
|
|
13362
13430
|
const result = await abstractSearch(context);
|
|
13363
13431
|
return {
|
|
13364
13432
|
...result
|
|
13365
13433
|
};
|
|
13366
13434
|
}
|
|
13367
|
-
var search_default5 = task(
|
|
13435
|
+
var search_default5 = task(run91, {
|
|
13368
13436
|
description: "Search for packages using auto-detected or specified package manager",
|
|
13369
13437
|
inputSchema: AbstractPkgSearchParamsSchema,
|
|
13370
13438
|
outputSchema: AbstractPkgSearchResultSchema
|
|
@@ -13376,10 +13444,10 @@ var AbstractPkgListParamsSchema = z.object({
|
|
|
13376
13444
|
packageManager: z.string().optional()
|
|
13377
13445
|
});
|
|
13378
13446
|
var AbstractPkgListResultSchema = AbstractPkgResultSchema;
|
|
13379
|
-
async function
|
|
13447
|
+
async function run92(context) {
|
|
13380
13448
|
return await abstractList(context);
|
|
13381
13449
|
}
|
|
13382
|
-
var list_default7 = task(
|
|
13450
|
+
var list_default7 = task(run92, {
|
|
13383
13451
|
description: "List installed packages using auto-detected or specified package manager",
|
|
13384
13452
|
inputSchema: AbstractPkgListParamsSchema,
|
|
13385
13453
|
outputSchema: AbstractPkgListResultSchema
|
|
@@ -13391,10 +13459,10 @@ var AbstractPkgCleanParamsSchema = AbstractPkgParamsSchema.pick({
|
|
|
13391
13459
|
sudo: true
|
|
13392
13460
|
});
|
|
13393
13461
|
var AbstractPkgCleanResultSchema = AbstractPkgResultSchema;
|
|
13394
|
-
async function
|
|
13462
|
+
async function run93(context) {
|
|
13395
13463
|
return await abstractClean(context);
|
|
13396
13464
|
}
|
|
13397
|
-
var clean_default5 = task(
|
|
13465
|
+
var clean_default5 = task(run93, {
|
|
13398
13466
|
description: "Clean package cache using auto-detected or specified package manager",
|
|
13399
13467
|
inputSchema: AbstractPkgCleanParamsSchema,
|
|
13400
13468
|
outputSchema: AbstractPkgCleanResultSchema
|
|
@@ -13448,7 +13516,7 @@ var K3supInstallOutputSchema = z.object({
|
|
|
13448
13516
|
/** The command that would be run if --print-command was used */
|
|
13449
13517
|
executedCommand: z.string().optional()
|
|
13450
13518
|
});
|
|
13451
|
-
async function
|
|
13519
|
+
async function run94(context) {
|
|
13452
13520
|
const { params, exec, log, error, debug } = context;
|
|
13453
13521
|
const k3supCmd = ["k3sup", "install"];
|
|
13454
13522
|
const addFlag = (flag, condition) => {
|
|
@@ -13506,7 +13574,7 @@ async function run98(context) {
|
|
|
13506
13574
|
throw e;
|
|
13507
13575
|
}
|
|
13508
13576
|
}
|
|
13509
|
-
var k3sup_install_default = task(
|
|
13577
|
+
var k3sup_install_default = task(run94, {
|
|
13510
13578
|
name: "k3sup-install",
|
|
13511
13579
|
description: "K3s k3sup-install.",
|
|
13512
13580
|
inputSchema: K3supInstallInputSchema,
|
|
@@ -14270,7 +14338,7 @@ var AddUsersOutputSchema = z.object({
|
|
|
14270
14338
|
error: z.string().optional()
|
|
14271
14339
|
})
|
|
14272
14340
|
);
|
|
14273
|
-
async function
|
|
14341
|
+
async function run95(context) {
|
|
14274
14342
|
const { params, info, warn, error, run: runTask } = context;
|
|
14275
14343
|
const { users } = params;
|
|
14276
14344
|
if (!users || users.length === 0) {
|
|
@@ -14303,7 +14371,7 @@ async function run99(context) {
|
|
|
14303
14371
|
return { success: false, error: message };
|
|
14304
14372
|
}
|
|
14305
14373
|
}
|
|
14306
|
-
var add_users_default = task(
|
|
14374
|
+
var add_users_default = task(run95, {
|
|
14307
14375
|
description: "Adds one or more users to the docker group.",
|
|
14308
14376
|
inputSchema: AddUsersInputSchema,
|
|
14309
14377
|
outputSchema: AddUsersOutputSchema
|
|
@@ -14323,7 +14391,7 @@ var InstallComposeOutputSchema = z.object({
|
|
|
14323
14391
|
error: z.string().optional()
|
|
14324
14392
|
})
|
|
14325
14393
|
);
|
|
14326
|
-
async function
|
|
14394
|
+
async function run96(context) {
|
|
14327
14395
|
const { params, info, error, run: runTask } = context;
|
|
14328
14396
|
const version2 = params.version ?? "v2.24.5";
|
|
14329
14397
|
const composePath = params.path ?? "/usr/local/bin/docker-compose";
|
|
@@ -14361,7 +14429,7 @@ async function run100(context) {
|
|
|
14361
14429
|
return { success: false, error: message };
|
|
14362
14430
|
}
|
|
14363
14431
|
}
|
|
14364
|
-
var install_compose_default = task(
|
|
14432
|
+
var install_compose_default = task(run96, {
|
|
14365
14433
|
description: "Installs the Docker Compose standalone binary.",
|
|
14366
14434
|
inputSchema: InstallComposeInputSchema,
|
|
14367
14435
|
outputSchema: InstallComposeOutputSchema
|
|
@@ -14384,7 +14452,7 @@ var DockerInstallOutputSchema = z.object({
|
|
|
14384
14452
|
error: z.string().optional()
|
|
14385
14453
|
})
|
|
14386
14454
|
);
|
|
14387
|
-
async function
|
|
14455
|
+
async function run97(context) {
|
|
14388
14456
|
const { info, run: runTask, params, error: logError2 } = context;
|
|
14389
14457
|
const installComposePlugin = params.install_compose_plugin !== false;
|
|
14390
14458
|
const installComposeStandalone = params.install_compose_standalone === true;
|
|
@@ -14623,7 +14691,7 @@ function sanitizeSystemctlState(value) {
|
|
|
14623
14691
|
}
|
|
14624
14692
|
return value.replace(/\u001b\][^\u001b]*\u001b\\/g, "").replace(/\u001b\[[0-9;?]*[ -/]*[@-~]/g, "").trim().toLowerCase();
|
|
14625
14693
|
}
|
|
14626
|
-
var install_default6 = task(
|
|
14694
|
+
var install_default6 = task(run97, {
|
|
14627
14695
|
name: "install",
|
|
14628
14696
|
description: "Installs and configures Docker, Docker Compose, and group membership.",
|
|
14629
14697
|
inputSchema: DockerInstallInputSchema,
|
|
@@ -14772,7 +14840,7 @@ var DockerRunContainerOutputSchema = z.object({
|
|
|
14772
14840
|
containerName: z.string().optional(),
|
|
14773
14841
|
error: z.string().optional()
|
|
14774
14842
|
});
|
|
14775
|
-
async function
|
|
14843
|
+
async function run98(context) {
|
|
14776
14844
|
const { params, exec, info, error: logError2 } = context;
|
|
14777
14845
|
if (!params.image) {
|
|
14778
14846
|
const message = "Docker image is required.";
|
|
@@ -14813,7 +14881,7 @@ async function run102(context) {
|
|
|
14813
14881
|
containerName: params.name
|
|
14814
14882
|
};
|
|
14815
14883
|
}
|
|
14816
|
-
var run_container_default = task(
|
|
14884
|
+
var run_container_default = task(run98, {
|
|
14817
14885
|
description: "Runs a Docker container and returns its output (attached).",
|
|
14818
14886
|
inputSchema: DockerRunContainerInputSchema,
|
|
14819
14887
|
outputSchema: DockerRunContainerOutputSchema
|
|
@@ -14830,7 +14898,7 @@ var DockerRunDetachedOutputSchema = z.object({
|
|
|
14830
14898
|
containerName: z.string().optional(),
|
|
14831
14899
|
error: z.string().optional()
|
|
14832
14900
|
});
|
|
14833
|
-
async function
|
|
14901
|
+
async function run99(context) {
|
|
14834
14902
|
const { params, exec, info, error: logError2 } = context;
|
|
14835
14903
|
if (!params.image) {
|
|
14836
14904
|
const message = "Docker image is required.";
|
|
@@ -14870,7 +14938,7 @@ async function run103(context) {
|
|
|
14870
14938
|
containerName: params.name
|
|
14871
14939
|
};
|
|
14872
14940
|
}
|
|
14873
|
-
var run_container_detached_default = task(
|
|
14941
|
+
var run_container_detached_default = task(run99, {
|
|
14874
14942
|
description: "Runs a Docker container in detached mode and returns its metadata.",
|
|
14875
14943
|
inputSchema: DockerRunDetachedInputSchema,
|
|
14876
14944
|
outputSchema: DockerRunDetachedOutputSchema
|
|
@@ -14929,7 +14997,7 @@ var ProcessListOutputSchema = z.object({
|
|
|
14929
14997
|
error: z.string().optional()
|
|
14930
14998
|
})
|
|
14931
14999
|
);
|
|
14932
|
-
async function
|
|
15000
|
+
async function run100(context) {
|
|
14933
15001
|
const { params, exec, debug, error } = context;
|
|
14934
15002
|
const { user, command, limit, sort, reverse } = params;
|
|
14935
15003
|
try {
|
|
@@ -15015,7 +15083,7 @@ async function run104(context) {
|
|
|
15015
15083
|
return { success: false, error: errorMsg };
|
|
15016
15084
|
}
|
|
15017
15085
|
}
|
|
15018
|
-
var list_default8 = task(
|
|
15086
|
+
var list_default8 = task(run100, {
|
|
15019
15087
|
name: "list",
|
|
15020
15088
|
description: "Lists processes on the system.",
|
|
15021
15089
|
inputSchema: ProcessListInputSchema,
|
|
@@ -15061,7 +15129,7 @@ var ProcessSearchOutputSchema = z.object({
|
|
|
15061
15129
|
error: z.string().optional()
|
|
15062
15130
|
})
|
|
15063
15131
|
);
|
|
15064
|
-
async function
|
|
15132
|
+
async function run101(context) {
|
|
15065
15133
|
const { params, exec, debug, error } = context;
|
|
15066
15134
|
const { name, user, pid, ppid, args, state, regex = false, ignoreCase = false, limit } = params;
|
|
15067
15135
|
debug(`Searching processes with params: ${JSON.stringify(params)}`);
|
|
@@ -15175,7 +15243,7 @@ function filterProcesses(processes, filters) {
|
|
|
15175
15243
|
return true;
|
|
15176
15244
|
});
|
|
15177
15245
|
}
|
|
15178
|
-
var search_default6 = task(
|
|
15246
|
+
var search_default6 = task(run101, {
|
|
15179
15247
|
name: "search",
|
|
15180
15248
|
description: "Search for processes matching specified criteria.",
|
|
15181
15249
|
inputSchema: ProcessSearchInputSchema,
|
|
@@ -15203,7 +15271,7 @@ var ProcessKillOutputSchema = z.object({
|
|
|
15203
15271
|
error: z.string().optional()
|
|
15204
15272
|
})
|
|
15205
15273
|
);
|
|
15206
|
-
async function
|
|
15274
|
+
async function run102(context) {
|
|
15207
15275
|
const { params, exec, debug, error } = context;
|
|
15208
15276
|
const { pid, user, command, signal = "TERM", force = false, sudo = false } = params;
|
|
15209
15277
|
try {
|
|
@@ -15291,7 +15359,7 @@ async function run106(context) {
|
|
|
15291
15359
|
return { success: false, error: errorMsg };
|
|
15292
15360
|
}
|
|
15293
15361
|
}
|
|
15294
|
-
var kill_default = task(
|
|
15362
|
+
var kill_default = task(run102, {
|
|
15295
15363
|
name: "kill",
|
|
15296
15364
|
description: "Kills processes matching specified criteria. Requires at least one filtering parameter (pid, user, or command) to prevent accidental killing of all processes.",
|
|
15297
15365
|
inputSchema: ProcessKillInputSchema,
|
|
@@ -15312,7 +15380,7 @@ var ProcessSignalOutputSchema = z.object({
|
|
|
15312
15380
|
error: z.string().optional()
|
|
15313
15381
|
})
|
|
15314
15382
|
);
|
|
15315
|
-
async function
|
|
15383
|
+
async function run103(context) {
|
|
15316
15384
|
const { params, exec, debug, error } = context;
|
|
15317
15385
|
const { pid, signal = "TERM", sudo = false } = params;
|
|
15318
15386
|
if (!pid || pid <= 0) {
|
|
@@ -15335,7 +15403,7 @@ async function run107(context) {
|
|
|
15335
15403
|
return { success: false, error: errorMsg };
|
|
15336
15404
|
}
|
|
15337
15405
|
}
|
|
15338
|
-
var signal_default = task(
|
|
15406
|
+
var signal_default = task(run103, {
|
|
15339
15407
|
name: "signal",
|
|
15340
15408
|
description: "Sends a signal to a process.",
|
|
15341
15409
|
inputSchema: ProcessSignalInputSchema,
|
|
@@ -15371,7 +15439,7 @@ var ProcessInfoOutputSchema = z.object({
|
|
|
15371
15439
|
error: z.string().optional()
|
|
15372
15440
|
})
|
|
15373
15441
|
);
|
|
15374
|
-
async function
|
|
15442
|
+
async function run104(context) {
|
|
15375
15443
|
const { params, exec, debug, error } = context;
|
|
15376
15444
|
const { pid } = params;
|
|
15377
15445
|
if (!pid || pid <= 0) {
|
|
@@ -15447,7 +15515,7 @@ async function run108(context) {
|
|
|
15447
15515
|
return { success: false, error: errorMsg };
|
|
15448
15516
|
}
|
|
15449
15517
|
}
|
|
15450
|
-
var info_default7 = task(
|
|
15518
|
+
var info_default7 = task(run104, {
|
|
15451
15519
|
name: "info",
|
|
15452
15520
|
description: "Gets detailed information about a specific process.",
|
|
15453
15521
|
inputSchema: ProcessInfoInputSchema,
|
|
@@ -15511,7 +15579,7 @@ var ProcessTopOutputSchema = z.object({
|
|
|
15511
15579
|
timestamp: z.string()
|
|
15512
15580
|
})
|
|
15513
15581
|
);
|
|
15514
|
-
async function
|
|
15582
|
+
async function run105(context) {
|
|
15515
15583
|
const { params, exec, debug, error } = context;
|
|
15516
15584
|
const {
|
|
15517
15585
|
limit = 10,
|
|
@@ -15673,7 +15741,7 @@ function sortProcesses(processes, sort) {
|
|
|
15673
15741
|
}
|
|
15674
15742
|
});
|
|
15675
15743
|
}
|
|
15676
|
-
var top_default = task(
|
|
15744
|
+
var top_default = task(run105, {
|
|
15677
15745
|
name: "top",
|
|
15678
15746
|
description: "Get top processes with system information.",
|
|
15679
15747
|
inputSchema: ProcessTopInputSchema,
|
|
@@ -15737,7 +15805,7 @@ var ProcessStatsOutputSchema = z.object({
|
|
|
15737
15805
|
timestamp: z.string()
|
|
15738
15806
|
})
|
|
15739
15807
|
);
|
|
15740
|
-
async function
|
|
15808
|
+
async function run106(context) {
|
|
15741
15809
|
const { params, exec, debug, error } = context;
|
|
15742
15810
|
const { includeUsers = true, includeStates = true, includeCommands = false, commandLimit = 10 } = params;
|
|
15743
15811
|
debug(`Getting process statistics with params: ${JSON.stringify(params)}`);
|
|
@@ -15915,7 +15983,7 @@ function calculateCommandStats(processes, limit) {
|
|
|
15915
15983
|
}
|
|
15916
15984
|
return Array.from(commandMap.values()).sort((a, b) => b.cpu - a.cpu).slice(0, limit);
|
|
15917
15985
|
}
|
|
15918
|
-
var stats_default = task(
|
|
15986
|
+
var stats_default = task(run106, {
|
|
15919
15987
|
name: "stats",
|
|
15920
15988
|
description: "Get system-wide process statistics.",
|
|
15921
15989
|
inputSchema: ProcessStatsInputSchema,
|
|
@@ -15950,7 +16018,7 @@ var ProcessChildrenOutputSchema = z.object({
|
|
|
15950
16018
|
error: z.string().optional()
|
|
15951
16019
|
})
|
|
15952
16020
|
);
|
|
15953
|
-
async function
|
|
16021
|
+
async function run107(context) {
|
|
15954
16022
|
const { params, exec, debug, error } = context;
|
|
15955
16023
|
const { pid, recursive = false, maxDepth } = params;
|
|
15956
16024
|
debug(`Getting children for process ${pid} with params: ${JSON.stringify(params)}`);
|
|
@@ -16035,7 +16103,7 @@ async function getDescendants(exec, parentPid, currentDepth, maxDepth) {
|
|
|
16035
16103
|
}
|
|
16036
16104
|
return allDescendants;
|
|
16037
16105
|
}
|
|
16038
|
-
var children_default = task(
|
|
16106
|
+
var children_default = task(run107, {
|
|
16039
16107
|
name: "children",
|
|
16040
16108
|
description: "Get child processes of a given PID.",
|
|
16041
16109
|
inputSchema: ProcessChildrenInputSchema,
|
|
@@ -16068,7 +16136,7 @@ var RebootOutputSchema = z.object({
|
|
|
16068
16136
|
error: z.string().optional(),
|
|
16069
16137
|
status: z.string()
|
|
16070
16138
|
});
|
|
16071
|
-
async function
|
|
16139
|
+
async function run108(context) {
|
|
16072
16140
|
const { params, info, warn, exec } = context;
|
|
16073
16141
|
const time = params.time || "now";
|
|
16074
16142
|
const sudo = params.sudo ?? true;
|
|
@@ -16101,7 +16169,7 @@ stderr: ${stderr}`
|
|
|
16101
16169
|
};
|
|
16102
16170
|
}
|
|
16103
16171
|
}
|
|
16104
|
-
var reboot_default = task(
|
|
16172
|
+
var reboot_default = task(run108, {
|
|
16105
16173
|
description: "Reboots a system",
|
|
16106
16174
|
inputSchema: RebootInputSchema,
|
|
16107
16175
|
outputSchema: RebootOutputSchema
|
|
@@ -16121,7 +16189,7 @@ var ShutdownOutputSchema = z.object({
|
|
|
16121
16189
|
error: z.string().optional(),
|
|
16122
16190
|
status: z.string()
|
|
16123
16191
|
});
|
|
16124
|
-
async function
|
|
16192
|
+
async function run109(context) {
|
|
16125
16193
|
const { params, info, warn, exec } = context;
|
|
16126
16194
|
const time = params.time || "now";
|
|
16127
16195
|
const sudo = params.sudo ?? true;
|
|
@@ -16153,7 +16221,7 @@ stderr: ${stderr}`
|
|
|
16153
16221
|
};
|
|
16154
16222
|
}
|
|
16155
16223
|
}
|
|
16156
|
-
var shutdown_default = task(
|
|
16224
|
+
var shutdown_default = task(run109, {
|
|
16157
16225
|
description: "Shuts down a system",
|
|
16158
16226
|
inputSchema: ShutdownInputSchema,
|
|
16159
16227
|
outputSchema: ShutdownOutputSchema
|
|
@@ -16174,7 +16242,7 @@ var RebootIfNeededOutputSchema = z.object({
|
|
|
16174
16242
|
error: z.string().optional()
|
|
16175
16243
|
})
|
|
16176
16244
|
);
|
|
16177
|
-
async function
|
|
16245
|
+
async function run110(context) {
|
|
16178
16246
|
const { params, run: runTask, exec, error, info, warn } = context;
|
|
16179
16247
|
const delayInSeconds = Math.max(1, params.delay ?? 1);
|
|
16180
16248
|
const message = params.message ?? "Reboot is required. Initiating reboot sequence.";
|
|
@@ -16204,7 +16272,7 @@ ${stderr}`;
|
|
|
16204
16272
|
}
|
|
16205
16273
|
return { rebooting: true, success: true };
|
|
16206
16274
|
}
|
|
16207
|
-
var reboot_if_needed_default = task(
|
|
16275
|
+
var reboot_if_needed_default = task(run110, {
|
|
16208
16276
|
name: "reboot_if_needed",
|
|
16209
16277
|
description: "Reboot if needed.",
|
|
16210
16278
|
inputSchema: RebootIfNeededInputSchema,
|
|
@@ -16221,7 +16289,7 @@ var SystemUptimeOutputSchema = z.object({
|
|
|
16221
16289
|
days: z.number().optional(),
|
|
16222
16290
|
error: z.string().optional()
|
|
16223
16291
|
});
|
|
16224
|
-
async function
|
|
16292
|
+
async function run111(context) {
|
|
16225
16293
|
const { params, exec, error } = context;
|
|
16226
16294
|
const sudo = params.sudo ?? false;
|
|
16227
16295
|
const { success, stdout, stderr } = await exec(["cat", "/proc/uptime"], { sudo });
|
|
@@ -16240,7 +16308,7 @@ async function run115(context) {
|
|
|
16240
16308
|
days: Math.floor(uptimeSeconds / 86400)
|
|
16241
16309
|
};
|
|
16242
16310
|
}
|
|
16243
|
-
var uptime_default = task(
|
|
16311
|
+
var uptime_default = task(run111, {
|
|
16244
16312
|
name: "uptime",
|
|
16245
16313
|
description: "Report system uptime.",
|
|
16246
16314
|
inputSchema: SystemUptimeInputSchema,
|
|
@@ -16265,7 +16333,7 @@ var SystemDatetimeOutputSchema = z.object({
|
|
|
16265
16333
|
error: z.string().optional()
|
|
16266
16334
|
})
|
|
16267
16335
|
);
|
|
16268
|
-
async function
|
|
16336
|
+
async function run112(context) {
|
|
16269
16337
|
const { params, exec } = context;
|
|
16270
16338
|
const sudo = params.sudo ?? false;
|
|
16271
16339
|
const isoResult = await exec(["date", "--iso-8601=seconds"], { sudo }).catch((error) => error);
|
|
@@ -16286,7 +16354,7 @@ async function run116(context) {
|
|
|
16286
16354
|
timezone
|
|
16287
16355
|
};
|
|
16288
16356
|
}
|
|
16289
|
-
var datetime_default = task(
|
|
16357
|
+
var datetime_default = task(run112, {
|
|
16290
16358
|
name: "datetime",
|
|
16291
16359
|
description: "Report system time and timezone.",
|
|
16292
16360
|
inputSchema: SystemDatetimeInputSchema,
|
|
@@ -16313,7 +16381,7 @@ var SystemHardwareOutputSchema = z.object({
|
|
|
16313
16381
|
error: z.string().optional()
|
|
16314
16382
|
})
|
|
16315
16383
|
);
|
|
16316
|
-
async function
|
|
16384
|
+
async function run113(context) {
|
|
16317
16385
|
const { params, exec } = context;
|
|
16318
16386
|
const sudo = params.sudo ?? false;
|
|
16319
16387
|
const archResult = await exec(["uname", "-m"], { sudo }).catch((error) => error);
|
|
@@ -16340,7 +16408,7 @@ async function run117(context) {
|
|
|
16340
16408
|
memTotalKb: Number.isFinite(memTotalKb ?? NaN) ? memTotalKb : void 0
|
|
16341
16409
|
};
|
|
16342
16410
|
}
|
|
16343
|
-
var hardware_default = task(
|
|
16411
|
+
var hardware_default = task(run113, {
|
|
16344
16412
|
name: "hardware",
|
|
16345
16413
|
description: "Report CPU and memory details.",
|
|
16346
16414
|
inputSchema: SystemHardwareInputSchema,
|
|
@@ -16372,7 +16440,7 @@ var SystemdDisableOutputSchema = z.object({
|
|
|
16372
16440
|
error: z.string().optional()
|
|
16373
16441
|
})
|
|
16374
16442
|
);
|
|
16375
|
-
async function
|
|
16443
|
+
async function run114(context) {
|
|
16376
16444
|
const { params, exec, error } = context;
|
|
16377
16445
|
const { service, sudo = false } = params;
|
|
16378
16446
|
if (!service) {
|
|
@@ -16395,7 +16463,7 @@ async function run118(context) {
|
|
|
16395
16463
|
};
|
|
16396
16464
|
}
|
|
16397
16465
|
}
|
|
16398
|
-
var disable_default = task(
|
|
16466
|
+
var disable_default = task(run114, {
|
|
16399
16467
|
name: "disable",
|
|
16400
16468
|
description: "Systemd disable.",
|
|
16401
16469
|
inputSchema: SystemdDisableInputSchema,
|
|
@@ -16415,7 +16483,7 @@ var SystemdEnableOutputSchema = z.object({
|
|
|
16415
16483
|
error: z.string().optional()
|
|
16416
16484
|
})
|
|
16417
16485
|
);
|
|
16418
|
-
async function
|
|
16486
|
+
async function run115(context) {
|
|
16419
16487
|
const { params, exec, error } = context;
|
|
16420
16488
|
const { service, sudo = false } = params;
|
|
16421
16489
|
if (!service) {
|
|
@@ -16438,7 +16506,7 @@ async function run119(context) {
|
|
|
16438
16506
|
};
|
|
16439
16507
|
}
|
|
16440
16508
|
}
|
|
16441
|
-
var enable_default = task(
|
|
16509
|
+
var enable_default = task(run115, {
|
|
16442
16510
|
name: "enable",
|
|
16443
16511
|
description: "Systemd enable.",
|
|
16444
16512
|
inputSchema: SystemdEnableInputSchema,
|
|
@@ -16458,7 +16526,7 @@ var SystemdRestartOutputSchema = z.object({
|
|
|
16458
16526
|
error: z.string().optional()
|
|
16459
16527
|
})
|
|
16460
16528
|
);
|
|
16461
|
-
async function
|
|
16529
|
+
async function run116(context) {
|
|
16462
16530
|
const { params, exec, error } = context;
|
|
16463
16531
|
const { service, sudo = false } = params;
|
|
16464
16532
|
if (!service) {
|
|
@@ -16485,7 +16553,7 @@ async function run120(context) {
|
|
|
16485
16553
|
};
|
|
16486
16554
|
}
|
|
16487
16555
|
}
|
|
16488
|
-
var restart_default = task(
|
|
16556
|
+
var restart_default = task(run116, {
|
|
16489
16557
|
name: "restart",
|
|
16490
16558
|
description: "Systemd restart.",
|
|
16491
16559
|
inputSchema: SystemdRestartInputSchema,
|
|
@@ -16505,7 +16573,7 @@ var SystemdStartOutputSchema = z.object({
|
|
|
16505
16573
|
error: z.string().optional()
|
|
16506
16574
|
})
|
|
16507
16575
|
);
|
|
16508
|
-
async function
|
|
16576
|
+
async function run117(context) {
|
|
16509
16577
|
const { params, exec, error } = context;
|
|
16510
16578
|
const { service, sudo = false } = params;
|
|
16511
16579
|
if (!service) {
|
|
@@ -16528,7 +16596,7 @@ async function run121(context) {
|
|
|
16528
16596
|
};
|
|
16529
16597
|
}
|
|
16530
16598
|
}
|
|
16531
|
-
var start_default = task(
|
|
16599
|
+
var start_default = task(run117, {
|
|
16532
16600
|
name: "start",
|
|
16533
16601
|
description: "Systemd start.",
|
|
16534
16602
|
inputSchema: SystemdStartInputSchema,
|
|
@@ -16548,7 +16616,7 @@ var SystemdStopOutputSchema = z.object({
|
|
|
16548
16616
|
error: z.string().optional()
|
|
16549
16617
|
})
|
|
16550
16618
|
);
|
|
16551
|
-
async function
|
|
16619
|
+
async function run118(context) {
|
|
16552
16620
|
const { params, exec, error } = context;
|
|
16553
16621
|
const { service, sudo = false } = params;
|
|
16554
16622
|
if (!service) {
|
|
@@ -16575,7 +16643,7 @@ async function run122(context) {
|
|
|
16575
16643
|
};
|
|
16576
16644
|
}
|
|
16577
16645
|
}
|
|
16578
|
-
var stop_default = task(
|
|
16646
|
+
var stop_default = task(run118, {
|
|
16579
16647
|
name: "stop",
|
|
16580
16648
|
description: "Systemd stop.",
|
|
16581
16649
|
inputSchema: SystemdStopInputSchema,
|
|
@@ -16595,7 +16663,7 @@ var SystemdReloadOutputSchema = z.object({
|
|
|
16595
16663
|
error: z.string().optional()
|
|
16596
16664
|
})
|
|
16597
16665
|
);
|
|
16598
|
-
async function
|
|
16666
|
+
async function run119(context) {
|
|
16599
16667
|
const { params, exec, error } = context;
|
|
16600
16668
|
const { service, sudo = false } = params;
|
|
16601
16669
|
if (!service) {
|
|
@@ -16616,7 +16684,7 @@ async function run123(context) {
|
|
|
16616
16684
|
};
|
|
16617
16685
|
}
|
|
16618
16686
|
}
|
|
16619
|
-
var reload_default = task(
|
|
16687
|
+
var reload_default = task(run119, {
|
|
16620
16688
|
name: "reload",
|
|
16621
16689
|
description: "Reloads a systemd service (e.g., re-reads configuration without full restart).",
|
|
16622
16690
|
inputSchema: SystemdReloadInputSchema,
|
|
@@ -16638,7 +16706,7 @@ var SystemdStatusOutputSchema = z.object({
|
|
|
16638
16706
|
error: z.string().optional()
|
|
16639
16707
|
})
|
|
16640
16708
|
);
|
|
16641
|
-
async function
|
|
16709
|
+
async function run120(context) {
|
|
16642
16710
|
const { params, exec, error } = context;
|
|
16643
16711
|
const { service, sudo = false } = params;
|
|
16644
16712
|
if (!service) {
|
|
@@ -16661,7 +16729,7 @@ async function run124(context) {
|
|
|
16661
16729
|
};
|
|
16662
16730
|
}
|
|
16663
16731
|
}
|
|
16664
|
-
var status_default = task(
|
|
16732
|
+
var status_default = task(run120, {
|
|
16665
16733
|
name: "status",
|
|
16666
16734
|
description: "Checks systemd service status.",
|
|
16667
16735
|
inputSchema: SystemdStatusInputSchema,
|
|
@@ -16691,7 +16759,7 @@ var TemplateWriteOutputSchema = z.object({
|
|
|
16691
16759
|
path: z.string()
|
|
16692
16760
|
});
|
|
16693
16761
|
async function runFn3(context) {
|
|
16694
|
-
const { params, warn, error, debug, run:
|
|
16762
|
+
const { params, warn, error, debug, run: run249, file, exec } = context;
|
|
16695
16763
|
const { template, template_file, variables, to, mode, owner, group, sudo } = params;
|
|
16696
16764
|
let templateContent = template;
|
|
16697
16765
|
if (template && template_file) {
|
|
@@ -16746,7 +16814,7 @@ EOF`;
|
|
|
16746
16814
|
debug(`Setting mode ${mode} for ${outputPath}`);
|
|
16747
16815
|
try {
|
|
16748
16816
|
const chmodParams = { path: outputPath, mode, sudo };
|
|
16749
|
-
const chmodResult = await
|
|
16817
|
+
const chmodResult = await run249(chmod_default(chmodParams));
|
|
16750
16818
|
if (chmodResult instanceof Error) {
|
|
16751
16819
|
error(`Error setting mode for ${outputPath}: ${chmodResult.message}`);
|
|
16752
16820
|
overallSuccess = false;
|
|
@@ -16772,7 +16840,7 @@ EOF`;
|
|
|
16772
16840
|
if (group) {
|
|
16773
16841
|
chownTaskParams.group = group;
|
|
16774
16842
|
}
|
|
16775
|
-
const chownResult = await
|
|
16843
|
+
const chownResult = await run249(chown_default(chownTaskParams));
|
|
16776
16844
|
if (chownResult instanceof Error) {
|
|
16777
16845
|
error(`Error setting owner/group for ${outputPath}: ${chownResult.message}`);
|
|
16778
16846
|
overallSuccess = false;
|
|
@@ -16832,7 +16900,7 @@ var UfwAllowOutputSchema = z.object({
|
|
|
16832
16900
|
error: z.string().optional()
|
|
16833
16901
|
})
|
|
16834
16902
|
);
|
|
16835
|
-
async function
|
|
16903
|
+
async function run121(context) {
|
|
16836
16904
|
const { params, exec, info } = context;
|
|
16837
16905
|
const { port, proto = "tcp", from } = params;
|
|
16838
16906
|
if (!port) {
|
|
@@ -16863,7 +16931,7 @@ async function run125(context) {
|
|
|
16863
16931
|
return { success: false, error };
|
|
16864
16932
|
}
|
|
16865
16933
|
}
|
|
16866
|
-
var allow_default = task(
|
|
16934
|
+
var allow_default = task(run121, {
|
|
16867
16935
|
description: "Allows a port through UFW firewall.",
|
|
16868
16936
|
inputSchema: UfwAllowInputSchema,
|
|
16869
16937
|
outputSchema: UfwAllowOutputSchema
|
|
@@ -16884,7 +16952,7 @@ var UfwDenyOutputSchema = z.object({
|
|
|
16884
16952
|
error: z.string().optional()
|
|
16885
16953
|
})
|
|
16886
16954
|
);
|
|
16887
|
-
async function
|
|
16955
|
+
async function run122(context) {
|
|
16888
16956
|
const { params, exec, error, info } = context;
|
|
16889
16957
|
const { port, proto = "tcp", from } = params;
|
|
16890
16958
|
if (!port) {
|
|
@@ -16915,7 +16983,7 @@ async function run126(context) {
|
|
|
16915
16983
|
};
|
|
16916
16984
|
}
|
|
16917
16985
|
}
|
|
16918
|
-
var deny_default = task(
|
|
16986
|
+
var deny_default = task(run122, {
|
|
16919
16987
|
name: "deny",
|
|
16920
16988
|
description: "Ufw deny.",
|
|
16921
16989
|
inputSchema: UfwDenyInputSchema,
|
|
@@ -16934,7 +17002,7 @@ var UfwDeleteOutputSchema = z.object({
|
|
|
16934
17002
|
error: z.string().optional()
|
|
16935
17003
|
})
|
|
16936
17004
|
);
|
|
16937
|
-
async function
|
|
17005
|
+
async function run123(context) {
|
|
16938
17006
|
const { params, exec, error } = context;
|
|
16939
17007
|
const { rule_number } = params;
|
|
16940
17008
|
if (!rule_number || rule_number <= 0) {
|
|
@@ -16956,7 +17024,7 @@ async function run127(context) {
|
|
|
16956
17024
|
};
|
|
16957
17025
|
}
|
|
16958
17026
|
}
|
|
16959
|
-
var delete_default4 = task(
|
|
17027
|
+
var delete_default4 = task(run123, {
|
|
16960
17028
|
name: "delete",
|
|
16961
17029
|
description: "Ufw delete.",
|
|
16962
17030
|
inputSchema: UfwDeleteInputSchema,
|
|
@@ -16969,7 +17037,7 @@ var UfwDisableOutputSchema = z.object({
|
|
|
16969
17037
|
success: z.boolean(),
|
|
16970
17038
|
error: z.string().optional()
|
|
16971
17039
|
});
|
|
16972
|
-
async function
|
|
17040
|
+
async function run124(context) {
|
|
16973
17041
|
const { exec, error } = context;
|
|
16974
17042
|
try {
|
|
16975
17043
|
const result = await exec(["ufw", "disable"], { sudo: true });
|
|
@@ -16985,7 +17053,7 @@ async function run128(context) {
|
|
|
16985
17053
|
return { success: false, error: errorMsg };
|
|
16986
17054
|
}
|
|
16987
17055
|
}
|
|
16988
|
-
var disable_default2 = task(
|
|
17056
|
+
var disable_default2 = task(run124, {
|
|
16989
17057
|
description: "Disables UFW firewall.",
|
|
16990
17058
|
inputSchema: UfwDisableInputSchema,
|
|
16991
17059
|
outputSchema: UfwDisableOutputSchema
|
|
@@ -16997,7 +17065,7 @@ var UfwEnableOutputSchema = z.object({
|
|
|
16997
17065
|
success: z.boolean(),
|
|
16998
17066
|
error: z.string().optional()
|
|
16999
17067
|
});
|
|
17000
|
-
async function
|
|
17068
|
+
async function run125(context) {
|
|
17001
17069
|
const { exec, error } = context;
|
|
17002
17070
|
try {
|
|
17003
17071
|
const result = await exec(["ufw", "--force", "enable"], { sudo: true });
|
|
@@ -17013,7 +17081,7 @@ async function run129(context) {
|
|
|
17013
17081
|
return { success: false, error: errorMsg };
|
|
17014
17082
|
}
|
|
17015
17083
|
}
|
|
17016
|
-
var enable_default2 = task(
|
|
17084
|
+
var enable_default2 = task(run125, {
|
|
17017
17085
|
description: "Enables UFW firewall.",
|
|
17018
17086
|
inputSchema: UfwEnableInputSchema,
|
|
17019
17087
|
outputSchema: UfwEnableOutputSchema
|
|
@@ -17029,7 +17097,7 @@ var UfwInstallOutputSchema = z.object({
|
|
|
17029
17097
|
error: z.string().optional()
|
|
17030
17098
|
})
|
|
17031
17099
|
);
|
|
17032
|
-
async function
|
|
17100
|
+
async function run126(context) {
|
|
17033
17101
|
const { run: runTask, error } = context;
|
|
17034
17102
|
try {
|
|
17035
17103
|
const installResult = await runTask(install_default5({ package: "ufw", sudo: true }));
|
|
@@ -17048,7 +17116,7 @@ async function run130(context) {
|
|
|
17048
17116
|
};
|
|
17049
17117
|
}
|
|
17050
17118
|
}
|
|
17051
|
-
var install_default7 = task(
|
|
17119
|
+
var install_default7 = task(run126, {
|
|
17052
17120
|
name: "install",
|
|
17053
17121
|
description: "Ufw install.",
|
|
17054
17122
|
inputSchema: UfwInstallInputSchema,
|
|
@@ -17068,7 +17136,7 @@ var UfwLoggingOutputSchema = z.object({
|
|
|
17068
17136
|
error: z.string().optional()
|
|
17069
17137
|
})
|
|
17070
17138
|
);
|
|
17071
|
-
async function
|
|
17139
|
+
async function run127(context) {
|
|
17072
17140
|
const { params, exec, log } = context;
|
|
17073
17141
|
const level = params.level || "on";
|
|
17074
17142
|
try {
|
|
@@ -17085,7 +17153,7 @@ async function run131(context) {
|
|
|
17085
17153
|
return { success: false, error };
|
|
17086
17154
|
}
|
|
17087
17155
|
}
|
|
17088
|
-
var logging_default = task(
|
|
17156
|
+
var logging_default = task(run127, {
|
|
17089
17157
|
description: "Configures UFW logging",
|
|
17090
17158
|
inputSchema: UfwLoggingInputSchema,
|
|
17091
17159
|
outputSchema: UfwLoggingOutputSchema
|
|
@@ -17101,7 +17169,7 @@ var UfwReloadOutputSchema = z.object({
|
|
|
17101
17169
|
error: z.string().optional()
|
|
17102
17170
|
})
|
|
17103
17171
|
);
|
|
17104
|
-
async function
|
|
17172
|
+
async function run128(context) {
|
|
17105
17173
|
const { exec, error } = context;
|
|
17106
17174
|
try {
|
|
17107
17175
|
const { success } = await exec(["sudo", "ufw", "reload"], { sudo: true });
|
|
@@ -17113,7 +17181,7 @@ async function run132(context) {
|
|
|
17113
17181
|
};
|
|
17114
17182
|
}
|
|
17115
17183
|
}
|
|
17116
|
-
var reload_default2 = task(
|
|
17184
|
+
var reload_default2 = task(run128, {
|
|
17117
17185
|
name: "reload",
|
|
17118
17186
|
description: "Ufw reload.",
|
|
17119
17187
|
inputSchema: UfwReloadInputSchema,
|
|
@@ -17131,7 +17199,7 @@ var UfwResetOutputSchema = z.object({
|
|
|
17131
17199
|
error: z.string().optional()
|
|
17132
17200
|
})
|
|
17133
17201
|
);
|
|
17134
|
-
async function
|
|
17202
|
+
async function run129(context) {
|
|
17135
17203
|
const { exec, error, info } = context;
|
|
17136
17204
|
try {
|
|
17137
17205
|
const command = ["ufw", "--force", "reset"];
|
|
@@ -17152,7 +17220,7 @@ async function run133(context) {
|
|
|
17152
17220
|
return { success: false, error: errorMsg };
|
|
17153
17221
|
}
|
|
17154
17222
|
}
|
|
17155
|
-
var reset_default = task(
|
|
17223
|
+
var reset_default = task(run129, {
|
|
17156
17224
|
name: "reset",
|
|
17157
17225
|
description: "Resets UFW firewall to default state.",
|
|
17158
17226
|
inputSchema: UfwResetInputSchema,
|
|
@@ -17175,7 +17243,7 @@ var UfwStatusOutputSchema = z.object({
|
|
|
17175
17243
|
rules: z.array(UfwRuleSchema).optional(),
|
|
17176
17244
|
error: z.string().optional()
|
|
17177
17245
|
});
|
|
17178
|
-
async function
|
|
17246
|
+
async function run130(context) {
|
|
17179
17247
|
const { exec, error } = context;
|
|
17180
17248
|
try {
|
|
17181
17249
|
const result = await exec(["ufw", "status", "numbered"], { sudo: true });
|
|
@@ -17230,7 +17298,7 @@ async function run134(context) {
|
|
|
17230
17298
|
return { success: false, error: errorMsg };
|
|
17231
17299
|
}
|
|
17232
17300
|
}
|
|
17233
|
-
var status_default2 = task(
|
|
17301
|
+
var status_default2 = task(run130, {
|
|
17234
17302
|
description: "Gets UFW firewall status with numbered rules.",
|
|
17235
17303
|
inputSchema: UfwStatusInputSchema,
|
|
17236
17304
|
outputSchema: UfwStatusOutputSchema
|
|
@@ -17269,7 +17337,7 @@ var AddGroupsOutputSchema = z.object({
|
|
|
17269
17337
|
error: z.string().optional()
|
|
17270
17338
|
})
|
|
17271
17339
|
);
|
|
17272
|
-
async function
|
|
17340
|
+
async function run131(context) {
|
|
17273
17341
|
const { params, exec } = context;
|
|
17274
17342
|
const { user, groups, sudo = true } = params;
|
|
17275
17343
|
const normalizedGroups = Array.isArray(groups) ? groups : typeof groups === "string" ? groups.split(",").map((group) => group.trim()).filter(Boolean) : [];
|
|
@@ -17284,7 +17352,7 @@ async function run135(context) {
|
|
|
17284
17352
|
error: success ? void 0 : stderr || stdout
|
|
17285
17353
|
};
|
|
17286
17354
|
}
|
|
17287
|
-
var add_groups_default = task(
|
|
17355
|
+
var add_groups_default = task(run131, {
|
|
17288
17356
|
name: "add_groups",
|
|
17289
17357
|
description: "User add groups.",
|
|
17290
17358
|
inputSchema: AddGroupsInputSchema,
|
|
@@ -17304,7 +17372,7 @@ var GetGidOutputSchema = z.object({
|
|
|
17304
17372
|
gid: z.string().optional()
|
|
17305
17373
|
})
|
|
17306
17374
|
);
|
|
17307
|
-
async function
|
|
17375
|
+
async function run132(context) {
|
|
17308
17376
|
const { params, exec } = context;
|
|
17309
17377
|
const { user } = params;
|
|
17310
17378
|
const command = ["id", "-g", user].filter(Boolean).join(" ");
|
|
@@ -17314,7 +17382,7 @@ async function run136(context) {
|
|
|
17314
17382
|
gid: gid.trim()
|
|
17315
17383
|
};
|
|
17316
17384
|
}
|
|
17317
|
-
var get_gid_default = task(
|
|
17385
|
+
var get_gid_default = task(run132, {
|
|
17318
17386
|
name: "get_gid",
|
|
17319
17387
|
description: "User get gid.",
|
|
17320
17388
|
inputSchema: GetGidInputSchema,
|
|
@@ -17334,7 +17402,7 @@ var GetGroupsOutputSchema = z.object({
|
|
|
17334
17402
|
groups: z.array(z.string()).optional()
|
|
17335
17403
|
})
|
|
17336
17404
|
);
|
|
17337
|
-
async function
|
|
17405
|
+
async function run133(context) {
|
|
17338
17406
|
const { params, exec } = context;
|
|
17339
17407
|
const { user } = params;
|
|
17340
17408
|
const command = ["groups", user].filter(Boolean).join(" ");
|
|
@@ -17351,7 +17419,7 @@ async function run137(context) {
|
|
|
17351
17419
|
groups
|
|
17352
17420
|
};
|
|
17353
17421
|
}
|
|
17354
|
-
var get_groups_default = task(
|
|
17422
|
+
var get_groups_default = task(run133, {
|
|
17355
17423
|
name: "get_groups",
|
|
17356
17424
|
description: "User get groups.",
|
|
17357
17425
|
inputSchema: GetGroupsInputSchema,
|
|
@@ -17371,7 +17439,7 @@ var GetUidOutputSchema = z.object({
|
|
|
17371
17439
|
uid: z.string().optional()
|
|
17372
17440
|
})
|
|
17373
17441
|
);
|
|
17374
|
-
async function
|
|
17442
|
+
async function run134(context) {
|
|
17375
17443
|
const { params, exec } = context;
|
|
17376
17444
|
const { user } = params;
|
|
17377
17445
|
const command = ["id", "-u", user].filter(Boolean).join(" ");
|
|
@@ -17381,7 +17449,7 @@ async function run138(context) {
|
|
|
17381
17449
|
uid: uid.trim()
|
|
17382
17450
|
};
|
|
17383
17451
|
}
|
|
17384
|
-
var get_uid_default = task(
|
|
17452
|
+
var get_uid_default = task(run134, {
|
|
17385
17453
|
name: "get_uid",
|
|
17386
17454
|
description: "User get uid.",
|
|
17387
17455
|
inputSchema: GetUidInputSchema,
|
|
@@ -17402,7 +17470,7 @@ var SetUserGroupsOutputSchema = z.object({
|
|
|
17402
17470
|
error: z.string().optional()
|
|
17403
17471
|
})
|
|
17404
17472
|
);
|
|
17405
|
-
async function
|
|
17473
|
+
async function run135(context) {
|
|
17406
17474
|
const { params, exec } = context;
|
|
17407
17475
|
const { user, groups, sudo = true } = params;
|
|
17408
17476
|
const normalizedGroups = Array.isArray(groups) ? groups : typeof groups === "string" ? groups.split(",").map((group) => group.trim()).filter(Boolean) : [];
|
|
@@ -17417,7 +17485,7 @@ async function run139(context) {
|
|
|
17417
17485
|
error: success ? void 0 : stderr || stdout
|
|
17418
17486
|
};
|
|
17419
17487
|
}
|
|
17420
|
-
var set_groups_default = task(
|
|
17488
|
+
var set_groups_default = task(run135, {
|
|
17421
17489
|
name: "set_groups",
|
|
17422
17490
|
description: "User set groups.",
|
|
17423
17491
|
inputSchema: SetUserGroupsInputSchema,
|
|
@@ -17438,7 +17506,7 @@ var SetUserShellOutputSchema = z.object({
|
|
|
17438
17506
|
error: z.string().optional()
|
|
17439
17507
|
})
|
|
17440
17508
|
);
|
|
17441
|
-
async function
|
|
17509
|
+
async function run136(context) {
|
|
17442
17510
|
const { params, exec } = context;
|
|
17443
17511
|
const { user, shell, sudo = true } = params;
|
|
17444
17512
|
const command = [sudo ? "sudo" : "", "usermod", "-s", shell, user].filter(Boolean).join(" ");
|
|
@@ -17448,7 +17516,7 @@ async function run140(context) {
|
|
|
17448
17516
|
error: success ? void 0 : stderr || stdout
|
|
17449
17517
|
};
|
|
17450
17518
|
}
|
|
17451
|
-
var set_shell_default = task(
|
|
17519
|
+
var set_shell_default = task(run136, {
|
|
17452
17520
|
name: "set_shell",
|
|
17453
17521
|
description: "User set shell.",
|
|
17454
17522
|
inputSchema: SetUserShellInputSchema,
|
|
@@ -17467,8 +17535,8 @@ var UserDeleteOutputSchema = z.object({
|
|
|
17467
17535
|
success: z.boolean(),
|
|
17468
17536
|
error: z.string().optional()
|
|
17469
17537
|
});
|
|
17470
|
-
async function
|
|
17471
|
-
const { params, debug, exec, run:
|
|
17538
|
+
async function run137(context) {
|
|
17539
|
+
const { params, debug, exec, run: run249, error } = context;
|
|
17472
17540
|
const { user, remove: remove4 = false, sudo = true } = params;
|
|
17473
17541
|
if (!user) {
|
|
17474
17542
|
error('Required parameter "user" is missing');
|
|
@@ -17478,7 +17546,7 @@ async function run141(context) {
|
|
|
17478
17546
|
};
|
|
17479
17547
|
}
|
|
17480
17548
|
try {
|
|
17481
|
-
const { exists: userExists } = await
|
|
17549
|
+
const { exists: userExists } = await run249(exists_default4({ user }));
|
|
17482
17550
|
if (!userExists) {
|
|
17483
17551
|
debug(`User '${user}' does not exist, considering task successful (idempotent).`);
|
|
17484
17552
|
return { success: true };
|
|
@@ -17506,7 +17574,7 @@ async function run141(context) {
|
|
|
17506
17574
|
};
|
|
17507
17575
|
}
|
|
17508
17576
|
}
|
|
17509
|
-
var delete_default5 = task(
|
|
17577
|
+
var delete_default5 = task(run137, {
|
|
17510
17578
|
description: "Deletes a user from the system idempotently",
|
|
17511
17579
|
inputSchema: UserDeleteInputSchema,
|
|
17512
17580
|
outputSchema: UserDeleteOutputSchema
|
|
@@ -17536,7 +17604,7 @@ var ModifyUserOutputSchema = z.object({
|
|
|
17536
17604
|
error: z.string().optional()
|
|
17537
17605
|
})
|
|
17538
17606
|
);
|
|
17539
|
-
async function
|
|
17607
|
+
async function run138(context) {
|
|
17540
17608
|
const { params, exec, run: runTask, error } = context;
|
|
17541
17609
|
const {
|
|
17542
17610
|
user,
|
|
@@ -17595,7 +17663,7 @@ async function run142(context) {
|
|
|
17595
17663
|
};
|
|
17596
17664
|
}
|
|
17597
17665
|
}
|
|
17598
|
-
var modify_default2 = task(
|
|
17666
|
+
var modify_default2 = task(run138, {
|
|
17599
17667
|
name: "modify",
|
|
17600
17668
|
description: "Modify an existing user account.",
|
|
17601
17669
|
inputSchema: ModifyUserInputSchema,
|
|
@@ -17880,7 +17948,7 @@ var XcpngAttachVdiResultSchema = z.object({
|
|
|
17880
17948
|
plugged: z.boolean().optional(),
|
|
17881
17949
|
error: z.string().optional()
|
|
17882
17950
|
});
|
|
17883
|
-
async function
|
|
17951
|
+
async function run139(context) {
|
|
17884
17952
|
const { params, error, debug } = context;
|
|
17885
17953
|
const { vm_uuid, vdi_uuid, device = "0", mode = "RW", bootable: rawBootable = false } = params;
|
|
17886
17954
|
if (!vm_uuid) {
|
|
@@ -17939,7 +18007,7 @@ async function run143(context) {
|
|
|
17939
18007
|
plugged: true
|
|
17940
18008
|
};
|
|
17941
18009
|
}
|
|
17942
|
-
var attach_vdi_default = task(
|
|
18010
|
+
var attach_vdi_default = task(run139, {
|
|
17943
18011
|
inputSchema: XcpngAttachVdiParamsSchema,
|
|
17944
18012
|
outputSchema: XcpngAttachVdiResultSchema,
|
|
17945
18013
|
description: "Attaches an existing virtual disk image to a VM and plugs it into the guest."
|
|
@@ -18003,7 +18071,7 @@ var XcpngCreateVdiResultSchema = z.object({
|
|
|
18003
18071
|
command: z.string().optional(),
|
|
18004
18072
|
error: z.string().optional()
|
|
18005
18073
|
});
|
|
18006
|
-
async function
|
|
18074
|
+
async function run140(context) {
|
|
18007
18075
|
const { params, error } = context;
|
|
18008
18076
|
const { name_label, sr_uuid, size_bytes, size_mb, size_gb, description, type = "user", shareable = false } = params;
|
|
18009
18077
|
if (!name_label) {
|
|
@@ -18056,7 +18124,7 @@ async function run144(context) {
|
|
|
18056
18124
|
command: result.command
|
|
18057
18125
|
};
|
|
18058
18126
|
}
|
|
18059
|
-
var create_vdi_default = task(
|
|
18127
|
+
var create_vdi_default = task(run140, {
|
|
18060
18128
|
inputSchema: XcpngCreateVdiParamsSchema,
|
|
18061
18129
|
outputSchema: XcpngCreateVdiResultSchema,
|
|
18062
18130
|
description: "Creates a new virtual disk image on the specified XCP-ng storage repository."
|
|
@@ -18071,7 +18139,7 @@ var XcpngListSrParamsResultSchema = z.object({
|
|
|
18071
18139
|
items: z.any().optional(),
|
|
18072
18140
|
error: z.string().optional()
|
|
18073
18141
|
});
|
|
18074
|
-
async function
|
|
18142
|
+
async function run141(context) {
|
|
18075
18143
|
const filters = normalizeFilterArgs(context.params?.filters);
|
|
18076
18144
|
const result = await runXeCommand(context, "sr-param-list", filters);
|
|
18077
18145
|
if (!result.success) {
|
|
@@ -18085,7 +18153,7 @@ async function run145(context) {
|
|
|
18085
18153
|
items: parseKeyValueOutput(result.stdout)
|
|
18086
18154
|
};
|
|
18087
18155
|
}
|
|
18088
|
-
var list_sr_params_default = task(
|
|
18156
|
+
var list_sr_params_default = task(run141, {
|
|
18089
18157
|
inputSchema: XcpngListSrParamsParamsSchema,
|
|
18090
18158
|
outputSchema: XcpngListSrParamsResultSchema,
|
|
18091
18159
|
description: "Lists parameters for storage repositories (SRs) on an XCP-ng host."
|
|
@@ -18100,7 +18168,7 @@ var XcpngListStorageRepositoriesResultSchema = z.object({
|
|
|
18100
18168
|
items: z.array(z.any()).optional(),
|
|
18101
18169
|
error: z.string().optional()
|
|
18102
18170
|
});
|
|
18103
|
-
async function
|
|
18171
|
+
async function run142(context) {
|
|
18104
18172
|
const { params } = context;
|
|
18105
18173
|
const filters = normalizeFilterArgs(params?.filters);
|
|
18106
18174
|
const result = await runXeCommand(context, "sr-list", filters);
|
|
@@ -18149,7 +18217,7 @@ async function run146(context) {
|
|
|
18149
18217
|
items: enrichedItems
|
|
18150
18218
|
};
|
|
18151
18219
|
}
|
|
18152
|
-
var list_storage_repositories_default = task(
|
|
18220
|
+
var list_storage_repositories_default = task(run142, {
|
|
18153
18221
|
inputSchema: XcpngListStorageRepositoriesParamsSchema,
|
|
18154
18222
|
outputSchema: XcpngListStorageRepositoriesResultSchema,
|
|
18155
18223
|
description: "Lists storage repositories on an XCP-ng host."
|
|
@@ -18172,7 +18240,7 @@ var XcpngFindStorageRepositoryResultSchema = z.object({
|
|
|
18172
18240
|
multiple: z.boolean().optional(),
|
|
18173
18241
|
error: z.string().optional()
|
|
18174
18242
|
});
|
|
18175
|
-
async function
|
|
18243
|
+
async function run143(context) {
|
|
18176
18244
|
const params = context.params ?? {};
|
|
18177
18245
|
const {
|
|
18178
18246
|
name_label: nameLabel,
|
|
@@ -18292,7 +18360,7 @@ async function runListStorageRepositories(context, params) {
|
|
|
18292
18360
|
})
|
|
18293
18361
|
);
|
|
18294
18362
|
}
|
|
18295
|
-
var find_storage_repository_default = task(
|
|
18363
|
+
var find_storage_repository_default = task(run143, {
|
|
18296
18364
|
inputSchema: XcpngFindStorageRepositoryParamsSchema,
|
|
18297
18365
|
outputSchema: XcpngFindStorageRepositoryResultSchema,
|
|
18298
18366
|
description: "Finds a single storage repository on an XCP-ng host, optionally allowing multiple matches."
|
|
@@ -18325,7 +18393,7 @@ var XcpngAddDiskResultSchema = z.object({
|
|
|
18325
18393
|
plugged: z.boolean().optional(),
|
|
18326
18394
|
error: z.string().optional()
|
|
18327
18395
|
});
|
|
18328
|
-
async function
|
|
18396
|
+
async function run144(context) {
|
|
18329
18397
|
const { params, error } = context;
|
|
18330
18398
|
const {
|
|
18331
18399
|
vm_uuid: vmUuid,
|
|
@@ -18458,7 +18526,7 @@ async function destroyVdi(context, vdiUuid, appliedCommands) {
|
|
|
18458
18526
|
context.warn(`Failed to clean up VDI ${vdiUuid}: ${xeErrorMessage(result, "unknown error")}`);
|
|
18459
18527
|
}
|
|
18460
18528
|
}
|
|
18461
|
-
var add_disk_default = task(
|
|
18529
|
+
var add_disk_default = task(run144, {
|
|
18462
18530
|
inputSchema: XcpngAddDiskParamsSchema,
|
|
18463
18531
|
outputSchema: XcpngAddDiskResultSchema,
|
|
18464
18532
|
description: "Creates a VDI and attaches it to a VM on XCP-ng."
|
|
@@ -18477,7 +18545,7 @@ var XcpngAttachIsoResultSchema = z.object({
|
|
|
18477
18545
|
plugged: z.boolean().optional(),
|
|
18478
18546
|
error: z.string().optional()
|
|
18479
18547
|
});
|
|
18480
|
-
async function
|
|
18548
|
+
async function run145(context) {
|
|
18481
18549
|
const { params, error, debug } = context;
|
|
18482
18550
|
const { vm_uuid, iso_vdi_uuid, device, eject_before_insert = true } = params;
|
|
18483
18551
|
if (!vm_uuid) {
|
|
@@ -18570,7 +18638,7 @@ async function run149(context) {
|
|
|
18570
18638
|
plugged
|
|
18571
18639
|
};
|
|
18572
18640
|
}
|
|
18573
|
-
var attach_iso_default = task(
|
|
18641
|
+
var attach_iso_default = task(run145, {
|
|
18574
18642
|
inputSchema: XcpngAttachIsoParamsSchema,
|
|
18575
18643
|
outputSchema: XcpngAttachIsoResultSchema,
|
|
18576
18644
|
description: "Attaches an ISO image to a VM by invoking xe vm-cd-insert, ejecting existing media if requested."
|
|
@@ -18591,7 +18659,7 @@ var XcpngAttachNetworkInterfaceResultSchema = z.object({
|
|
|
18591
18659
|
plugged: z.boolean().optional(),
|
|
18592
18660
|
error: z.string().optional()
|
|
18593
18661
|
});
|
|
18594
|
-
async function
|
|
18662
|
+
async function run146(context) {
|
|
18595
18663
|
const { params, error, debug } = context;
|
|
18596
18664
|
const { vm_uuid, network_uuid, device = "0", mac_address, mtu } = params;
|
|
18597
18665
|
if (!vm_uuid) {
|
|
@@ -18656,7 +18724,7 @@ async function run150(context) {
|
|
|
18656
18724
|
plugged: true
|
|
18657
18725
|
};
|
|
18658
18726
|
}
|
|
18659
|
-
var attach_network_interface_default = task(
|
|
18727
|
+
var attach_network_interface_default = task(run146, {
|
|
18660
18728
|
inputSchema: XcpngAttachNetworkInterfaceParamsSchema,
|
|
18661
18729
|
outputSchema: XcpngAttachNetworkInterfaceResultSchema,
|
|
18662
18730
|
description: "Creates and plugs a virtual network interface for a VM on XCP-ng."
|
|
@@ -18671,7 +18739,7 @@ var XcpngListTemplateParamsResultSchema = z.object({
|
|
|
18671
18739
|
items: z.any().optional(),
|
|
18672
18740
|
error: z.string().optional()
|
|
18673
18741
|
});
|
|
18674
|
-
async function
|
|
18742
|
+
async function run147(context) {
|
|
18675
18743
|
const filters = normalizeFilterArgs(context.params?.filters);
|
|
18676
18744
|
const result = await runXeCommand(context, "template-param-list", filters);
|
|
18677
18745
|
if (!result.success) {
|
|
@@ -18685,7 +18753,7 @@ async function run151(context) {
|
|
|
18685
18753
|
items: parseKeyValueOutput(result.stdout)
|
|
18686
18754
|
};
|
|
18687
18755
|
}
|
|
18688
|
-
var list_template_params_default = task(
|
|
18756
|
+
var list_template_params_default = task(run147, {
|
|
18689
18757
|
inputSchema: XcpngListTemplateParamsParamsSchema,
|
|
18690
18758
|
outputSchema: XcpngListTemplateParamsResultSchema,
|
|
18691
18759
|
description: "Lists parameters for templates on an XCP-ng host."
|
|
@@ -18700,7 +18768,7 @@ var XcpngListTemplatesResultSchema = z.object({
|
|
|
18700
18768
|
items: z.array(z.any()).optional(),
|
|
18701
18769
|
error: z.string().optional()
|
|
18702
18770
|
});
|
|
18703
|
-
async function
|
|
18771
|
+
async function run148(context) {
|
|
18704
18772
|
const filters = normalizeFilterArgs(context.params?.filters);
|
|
18705
18773
|
const result = await runXeCommand(context, "template-list", filters);
|
|
18706
18774
|
if (!result.success) {
|
|
@@ -18750,7 +18818,7 @@ async function run152(context) {
|
|
|
18750
18818
|
items: enriched
|
|
18751
18819
|
};
|
|
18752
18820
|
}
|
|
18753
|
-
var list_templates_default = task(
|
|
18821
|
+
var list_templates_default = task(run148, {
|
|
18754
18822
|
inputSchema: XcpngListTemplatesParamsSchema,
|
|
18755
18823
|
outputSchema: XcpngListTemplatesResultSchema,
|
|
18756
18824
|
description: "Lists VM templates available on the XCP-ng host."
|
|
@@ -18771,7 +18839,7 @@ var XcpngFindTemplateResultSchema = z.object({
|
|
|
18771
18839
|
multiple: z.boolean().optional(),
|
|
18772
18840
|
error: z.string().optional()
|
|
18773
18841
|
});
|
|
18774
|
-
async function
|
|
18842
|
+
async function run149(context) {
|
|
18775
18843
|
const params = context.params ?? {};
|
|
18776
18844
|
const {
|
|
18777
18845
|
name_label: nameLabel,
|
|
@@ -18869,7 +18937,7 @@ async function runListTemplates(context, params) {
|
|
|
18869
18937
|
})
|
|
18870
18938
|
);
|
|
18871
18939
|
}
|
|
18872
|
-
var find_template_default = task(
|
|
18940
|
+
var find_template_default = task(run149, {
|
|
18873
18941
|
inputSchema: XcpngFindTemplateParamsSchema,
|
|
18874
18942
|
outputSchema: XcpngFindTemplateResultSchema,
|
|
18875
18943
|
description: "Finds a single template on an XCP-ng host, optionally allowing multiple matches."
|
|
@@ -18894,7 +18962,7 @@ var XcpngCloneTemplateResultSchema = z.object({
|
|
|
18894
18962
|
alreadyExists: z.boolean().optional(),
|
|
18895
18963
|
error: z.string().optional()
|
|
18896
18964
|
});
|
|
18897
|
-
async function
|
|
18965
|
+
async function run150(context) {
|
|
18898
18966
|
const { params, error } = context;
|
|
18899
18967
|
const {
|
|
18900
18968
|
source_template_uuid: sourceTemplateUuidParam,
|
|
@@ -19014,7 +19082,7 @@ async function run154(context) {
|
|
|
19014
19082
|
appliedCommands
|
|
19015
19083
|
};
|
|
19016
19084
|
}
|
|
19017
|
-
var clone_template_default = task(
|
|
19085
|
+
var clone_template_default = task(run150, {
|
|
19018
19086
|
inputSchema: XcpngCloneTemplateParamsSchema,
|
|
19019
19087
|
outputSchema: XcpngCloneTemplateResultSchema,
|
|
19020
19088
|
description: "Clones an existing XCP-ng template to a new template name."
|
|
@@ -19029,7 +19097,7 @@ var XcpngListHostsResultSchema = z.object({
|
|
|
19029
19097
|
items: z.any().optional(),
|
|
19030
19098
|
error: z.string().optional()
|
|
19031
19099
|
});
|
|
19032
|
-
async function
|
|
19100
|
+
async function run151(context) {
|
|
19033
19101
|
const filters = normalizeFilterArgs(context.params?.filters);
|
|
19034
19102
|
const result = await runXeCommand(context, "host-list", filters);
|
|
19035
19103
|
if (!result.success) {
|
|
@@ -19043,7 +19111,7 @@ async function run155(context) {
|
|
|
19043
19111
|
items: parseKeyValueOutput(result.stdout)
|
|
19044
19112
|
};
|
|
19045
19113
|
}
|
|
19046
|
-
var list_hosts_default = task(
|
|
19114
|
+
var list_hosts_default = task(run151, {
|
|
19047
19115
|
inputSchema: XcpngListHostsParamsSchema,
|
|
19048
19116
|
outputSchema: XcpngListHostsResultSchema,
|
|
19049
19117
|
description: "Lists hosts in an XCP-ng pool, returning parsed xe host-list output."
|
|
@@ -19064,7 +19132,7 @@ var XcpngFindHostResultSchema = z.object({
|
|
|
19064
19132
|
multiple: z.boolean().optional(),
|
|
19065
19133
|
error: z.string().optional()
|
|
19066
19134
|
});
|
|
19067
|
-
async function
|
|
19135
|
+
async function run152(context) {
|
|
19068
19136
|
const params = context.params ?? {};
|
|
19069
19137
|
const {
|
|
19070
19138
|
name_label: nameLabel,
|
|
@@ -19164,7 +19232,7 @@ async function runListHosts(context, params) {
|
|
|
19164
19232
|
})
|
|
19165
19233
|
);
|
|
19166
19234
|
}
|
|
19167
|
-
var find_host_default = task(
|
|
19235
|
+
var find_host_default = task(run152, {
|
|
19168
19236
|
inputSchema: XcpngFindHostParamsSchema,
|
|
19169
19237
|
outputSchema: XcpngFindHostResultSchema,
|
|
19170
19238
|
description: "Finds a single host on an XCP-ng pool, optionally allowing multiple matches."
|
|
@@ -19179,7 +19247,7 @@ var XcpngListNetworkParamsResultSchema = z.object({
|
|
|
19179
19247
|
items: z.any().optional(),
|
|
19180
19248
|
error: z.string().optional()
|
|
19181
19249
|
});
|
|
19182
|
-
async function
|
|
19250
|
+
async function run153(context) {
|
|
19183
19251
|
const filters = normalizeFilterArgs(context.params?.filters);
|
|
19184
19252
|
const result = await runXeCommand(context, "network-param-list", filters);
|
|
19185
19253
|
if (!result.success) {
|
|
@@ -19193,7 +19261,7 @@ async function run157(context) {
|
|
|
19193
19261
|
items: parseKeyValueOutput(result.stdout)
|
|
19194
19262
|
};
|
|
19195
19263
|
}
|
|
19196
|
-
var list_network_params_default = task(
|
|
19264
|
+
var list_network_params_default = task(run153, {
|
|
19197
19265
|
inputSchema: XcpngListNetworkParamsParamsSchema,
|
|
19198
19266
|
outputSchema: XcpngListNetworkParamsResultSchema,
|
|
19199
19267
|
description: "Lists parameters for networks on an XCP-ng host."
|
|
@@ -19208,7 +19276,7 @@ var XcpngListNetworksResultSchema = z.object({
|
|
|
19208
19276
|
items: z.array(z.any()).optional(),
|
|
19209
19277
|
error: z.string().optional()
|
|
19210
19278
|
});
|
|
19211
|
-
async function
|
|
19279
|
+
async function run154(context) {
|
|
19212
19280
|
const { params } = context;
|
|
19213
19281
|
const filters = normalizeFilterArgs(params?.filters);
|
|
19214
19282
|
const result = await runXeCommand(context, "network-list", filters);
|
|
@@ -19257,7 +19325,7 @@ async function run158(context) {
|
|
|
19257
19325
|
items: enrichedItems
|
|
19258
19326
|
};
|
|
19259
19327
|
}
|
|
19260
|
-
var list_networks_default = task(
|
|
19328
|
+
var list_networks_default = task(run154, {
|
|
19261
19329
|
inputSchema: XcpngListNetworksParamsSchema,
|
|
19262
19330
|
outputSchema: XcpngListNetworksResultSchema,
|
|
19263
19331
|
description: "Lists networks on an XCP-ng host."
|
|
@@ -19278,7 +19346,7 @@ var XcpngFindNetworkResultSchema = z.object({
|
|
|
19278
19346
|
multiple: z.boolean().optional(),
|
|
19279
19347
|
error: z.string().optional()
|
|
19280
19348
|
});
|
|
19281
|
-
async function
|
|
19349
|
+
async function run155(context) {
|
|
19282
19350
|
const params = context.params ?? {};
|
|
19283
19351
|
const {
|
|
19284
19352
|
name_label: nameLabel,
|
|
@@ -19369,7 +19437,7 @@ function buildMultipleMessage4(nameLabel, uuid, count) {
|
|
|
19369
19437
|
const detail = identifiers.length > 0 ? identifiers.join(", ") : "specified criteria";
|
|
19370
19438
|
return `Multiple networks (${count}) matched ${detail}; refine filters or set allow_multiple:true.`;
|
|
19371
19439
|
}
|
|
19372
|
-
var find_network_default = task(
|
|
19440
|
+
var find_network_default = task(run155, {
|
|
19373
19441
|
inputSchema: XcpngFindNetworkParamsSchema,
|
|
19374
19442
|
outputSchema: XcpngFindNetworkResultSchema,
|
|
19375
19443
|
description: "Finds a single network on an XCP-ng host, optionally allowing multiple matches."
|
|
@@ -19396,7 +19464,7 @@ var XcpngCreateBondResultSchema = z.object({
|
|
|
19396
19464
|
appliedCommands: z.array(z.string()),
|
|
19397
19465
|
error: z.string().optional()
|
|
19398
19466
|
});
|
|
19399
|
-
async function
|
|
19467
|
+
async function run156(context) {
|
|
19400
19468
|
const { params, error } = context;
|
|
19401
19469
|
const {
|
|
19402
19470
|
host_uuid: hostUuidParam,
|
|
@@ -19518,7 +19586,7 @@ async function run160(context) {
|
|
|
19518
19586
|
appliedCommands
|
|
19519
19587
|
};
|
|
19520
19588
|
}
|
|
19521
|
-
var create_bond_default = task(
|
|
19589
|
+
var create_bond_default = task(run156, {
|
|
19522
19590
|
inputSchema: XcpngCreateBondParamsSchema,
|
|
19523
19591
|
outputSchema: XcpngCreateBondResultSchema,
|
|
19524
19592
|
description: "Creates a bonded interface on a host, wrapping xe bond-create."
|
|
@@ -19533,7 +19601,7 @@ var XcpngListPbdParamsResultSchema = z.object({
|
|
|
19533
19601
|
items: z.any().optional(),
|
|
19534
19602
|
error: z.string().optional()
|
|
19535
19603
|
});
|
|
19536
|
-
async function
|
|
19604
|
+
async function run157(context) {
|
|
19537
19605
|
const filters = normalizeFilterArgs(context.params?.filters);
|
|
19538
19606
|
const result = await runXeCommand(context, "pbd-param-list", filters);
|
|
19539
19607
|
if (!result.success) {
|
|
@@ -19547,7 +19615,7 @@ async function run161(context) {
|
|
|
19547
19615
|
items: parseKeyValueOutput(result.stdout)
|
|
19548
19616
|
};
|
|
19549
19617
|
}
|
|
19550
|
-
var list_pbd_params_default = task(
|
|
19618
|
+
var list_pbd_params_default = task(run157, {
|
|
19551
19619
|
inputSchema: XcpngListPbdParamsParamsSchema,
|
|
19552
19620
|
outputSchema: XcpngListPbdParamsResultSchema,
|
|
19553
19621
|
description: "Lists parameters for PBDs on an XCP-ng host."
|
|
@@ -19562,7 +19630,7 @@ var XcpngListPbdsResultSchema = z.object({
|
|
|
19562
19630
|
items: z.array(z.any()).optional(),
|
|
19563
19631
|
error: z.string().optional()
|
|
19564
19632
|
});
|
|
19565
|
-
async function
|
|
19633
|
+
async function run158(context) {
|
|
19566
19634
|
const filters = normalizeFilterArgs(context.params?.filters);
|
|
19567
19635
|
const result = await runXeCommand(context, "pbd-list", filters);
|
|
19568
19636
|
if (!result.success) {
|
|
@@ -19610,7 +19678,7 @@ async function run162(context) {
|
|
|
19610
19678
|
items: enrichedItems
|
|
19611
19679
|
};
|
|
19612
19680
|
}
|
|
19613
|
-
var list_pbds_default = task(
|
|
19681
|
+
var list_pbds_default = task(run158, {
|
|
19614
19682
|
inputSchema: XcpngListPbdsParamsSchema,
|
|
19615
19683
|
outputSchema: XcpngListPbdsResultSchema,
|
|
19616
19684
|
description: "Lists storage bindings (PBDs) between hosts and storage repositories."
|
|
@@ -19632,7 +19700,7 @@ var XcpngFindPbdResultSchema = z.object({
|
|
|
19632
19700
|
multiple: z.boolean().optional(),
|
|
19633
19701
|
error: z.string().optional()
|
|
19634
19702
|
});
|
|
19635
|
-
async function
|
|
19703
|
+
async function run159(context) {
|
|
19636
19704
|
const params = context.params ?? {};
|
|
19637
19705
|
const {
|
|
19638
19706
|
uuid,
|
|
@@ -19745,7 +19813,7 @@ async function runListPbds(context, params) {
|
|
|
19745
19813
|
})
|
|
19746
19814
|
);
|
|
19747
19815
|
}
|
|
19748
|
-
var find_pbd_default = task(
|
|
19816
|
+
var find_pbd_default = task(run159, {
|
|
19749
19817
|
inputSchema: XcpngFindPbdParamsSchema,
|
|
19750
19818
|
outputSchema: XcpngFindPbdResultSchema,
|
|
19751
19819
|
description: "Finds a single PBD (host \u2194 SR binding), optionally allowing multiple matches."
|
|
@@ -19770,7 +19838,7 @@ var XcpngCreatePbdResultSchema = z.object({
|
|
|
19770
19838
|
skipped: z.boolean().optional(),
|
|
19771
19839
|
error: z.string().optional()
|
|
19772
19840
|
});
|
|
19773
|
-
async function
|
|
19841
|
+
async function run160(context) {
|
|
19774
19842
|
const { params, error } = context;
|
|
19775
19843
|
const {
|
|
19776
19844
|
host_uuid: hostUuidParam,
|
|
@@ -19887,7 +19955,7 @@ async function run164(context) {
|
|
|
19887
19955
|
appliedCommands
|
|
19888
19956
|
};
|
|
19889
19957
|
}
|
|
19890
|
-
var create_pbd_default = task(
|
|
19958
|
+
var create_pbd_default = task(run160, {
|
|
19891
19959
|
inputSchema: XcpngCreatePbdParamsSchema,
|
|
19892
19960
|
outputSchema: XcpngCreatePbdResultSchema,
|
|
19893
19961
|
description: "Creates a host \u2194 storage repository binding (PBD)."
|
|
@@ -19902,7 +19970,7 @@ var XcpngListVmParamsResultSchema = z.object({
|
|
|
19902
19970
|
items: z.any().optional(),
|
|
19903
19971
|
error: z.string().optional()
|
|
19904
19972
|
});
|
|
19905
|
-
async function
|
|
19973
|
+
async function run161(context) {
|
|
19906
19974
|
const filters = normalizeFilterArgs(context.params?.filters);
|
|
19907
19975
|
const result = await runXeCommand(context, "vm-param-list", filters);
|
|
19908
19976
|
if (!result.success) {
|
|
@@ -19916,7 +19984,7 @@ async function run165(context) {
|
|
|
19916
19984
|
items: parseKeyValueOutput(result.stdout)
|
|
19917
19985
|
};
|
|
19918
19986
|
}
|
|
19919
|
-
var list_vm_params_default = task(
|
|
19987
|
+
var list_vm_params_default = task(run161, {
|
|
19920
19988
|
inputSchema: XcpngListVmParamsParamsSchema,
|
|
19921
19989
|
outputSchema: XcpngListVmParamsResultSchema,
|
|
19922
19990
|
description: "Lists virtual machines (VMs) on an XCP-ng host."
|
|
@@ -19932,7 +20000,7 @@ var XcpngListVmsResultSchema = z.object({
|
|
|
19932
20000
|
items: z.array(z.any()).optional(),
|
|
19933
20001
|
error: z.string().optional()
|
|
19934
20002
|
});
|
|
19935
|
-
async function
|
|
20003
|
+
async function run162(context) {
|
|
19936
20004
|
const { params } = context;
|
|
19937
20005
|
const filters = normalizeFilterArgs(params?.filters);
|
|
19938
20006
|
const paramsArg = buildParamsArg(params?.params);
|
|
@@ -19985,7 +20053,7 @@ async function run166(context) {
|
|
|
19985
20053
|
items: enrichedItems
|
|
19986
20054
|
};
|
|
19987
20055
|
}
|
|
19988
|
-
var list_vms_default = task(
|
|
20056
|
+
var list_vms_default = task(run162, {
|
|
19989
20057
|
inputSchema: XcpngListVmsParamsSchema,
|
|
19990
20058
|
outputSchema: XcpngListVmsResultSchema,
|
|
19991
20059
|
description: "Lists VMs on an XCP-ng host and returns structured metadata."
|
|
@@ -20036,7 +20104,7 @@ var XcpngFindVmResultSchema = z.object({
|
|
|
20036
20104
|
multiple: z.boolean().optional(),
|
|
20037
20105
|
error: z.string().optional()
|
|
20038
20106
|
});
|
|
20039
|
-
async function
|
|
20107
|
+
async function run163(context) {
|
|
20040
20108
|
const params = context.params ?? {};
|
|
20041
20109
|
const {
|
|
20042
20110
|
name_label: nameLabel,
|
|
@@ -20164,7 +20232,7 @@ async function runListVms(context, params) {
|
|
|
20164
20232
|
})
|
|
20165
20233
|
);
|
|
20166
20234
|
}
|
|
20167
|
-
var find_vm_default = task(
|
|
20235
|
+
var find_vm_default = task(run163, {
|
|
20168
20236
|
inputSchema: XcpngFindVmParamsSchema,
|
|
20169
20237
|
outputSchema: XcpngFindVmResultSchema,
|
|
20170
20238
|
description: "Finds a single VM on an XCP-ng host, optionally allowing multiple matches."
|
|
@@ -20269,7 +20337,7 @@ var XcpngCreateTemplateResultSchema = z.object({
|
|
|
20269
20337
|
powerState: z.string().optional(),
|
|
20270
20338
|
waitAttempts: z.number().optional()
|
|
20271
20339
|
});
|
|
20272
|
-
async function
|
|
20340
|
+
async function run164(context) {
|
|
20273
20341
|
const { params, error } = context;
|
|
20274
20342
|
const {
|
|
20275
20343
|
source_vm_uuid: sourceVmUuidParam,
|
|
@@ -20377,7 +20445,7 @@ async function run168(context) {
|
|
|
20377
20445
|
waitAttempts: ensureHalted.attempts
|
|
20378
20446
|
};
|
|
20379
20447
|
}
|
|
20380
|
-
var create_template_default = task(
|
|
20448
|
+
var create_template_default = task(run164, {
|
|
20381
20449
|
inputSchema: XcpngCreateTemplateParamsSchema,
|
|
20382
20450
|
outputSchema: XcpngCreateTemplateResultSchema,
|
|
20383
20451
|
description: "Clones a VM and converts it into an XCP-ng template."
|
|
@@ -20404,7 +20472,7 @@ var XcpngCreateVmResultSchema = z.object({
|
|
|
20404
20472
|
appliedCommands: z.array(z.string()),
|
|
20405
20473
|
error: z.string().optional()
|
|
20406
20474
|
});
|
|
20407
|
-
async function
|
|
20475
|
+
async function run165(context) {
|
|
20408
20476
|
const { params, error } = context;
|
|
20409
20477
|
const {
|
|
20410
20478
|
name_label,
|
|
@@ -20530,7 +20598,7 @@ async function run169(context) {
|
|
|
20530
20598
|
appliedCommands
|
|
20531
20599
|
};
|
|
20532
20600
|
}
|
|
20533
|
-
var create_vm_default = task(
|
|
20601
|
+
var create_vm_default = task(run165, {
|
|
20534
20602
|
inputSchema: XcpngCreateVmParamsSchema,
|
|
20535
20603
|
outputSchema: XcpngCreateVmResultSchema,
|
|
20536
20604
|
description: "Creates a new VM on XCP-ng and optionally applies memory and CPU sizing."
|
|
@@ -20545,7 +20613,7 @@ var XcpngListVdiParamsResultSchema = z.object({
|
|
|
20545
20613
|
items: z.any().optional(),
|
|
20546
20614
|
error: z.string().optional()
|
|
20547
20615
|
});
|
|
20548
|
-
async function
|
|
20616
|
+
async function run166(context) {
|
|
20549
20617
|
const filters = normalizeFilterArgs(context.params?.filters);
|
|
20550
20618
|
const result = await runXeCommand(context, "vdi-param-list", filters);
|
|
20551
20619
|
if (!result.success) {
|
|
@@ -20559,7 +20627,7 @@ async function run170(context) {
|
|
|
20559
20627
|
items: parseKeyValueOutput(result.stdout)
|
|
20560
20628
|
};
|
|
20561
20629
|
}
|
|
20562
|
-
var list_vdi_params_default = task(
|
|
20630
|
+
var list_vdi_params_default = task(run166, {
|
|
20563
20631
|
inputSchema: XcpngListVdiParamsParamsSchema,
|
|
20564
20632
|
outputSchema: XcpngListVdiParamsResultSchema,
|
|
20565
20633
|
description: "Lists virtual disk image parameters (VDI params) on an XCP-ng host."
|
|
@@ -20574,7 +20642,7 @@ var XcpngListVdisResultSchema = z.object({
|
|
|
20574
20642
|
items: z.array(z.any()).optional(),
|
|
20575
20643
|
error: z.string().optional()
|
|
20576
20644
|
});
|
|
20577
|
-
async function
|
|
20645
|
+
async function run167(context) {
|
|
20578
20646
|
const { params } = context;
|
|
20579
20647
|
const filters = normalizeFilterArgs(params?.filters);
|
|
20580
20648
|
const result = await runXeCommand(context, "vdi-list", filters);
|
|
@@ -20625,7 +20693,7 @@ async function run171(context) {
|
|
|
20625
20693
|
items: enrichedItems
|
|
20626
20694
|
};
|
|
20627
20695
|
}
|
|
20628
|
-
var list_vdis_default = task(
|
|
20696
|
+
var list_vdis_default = task(run167, {
|
|
20629
20697
|
inputSchema: XcpngListVdisParamsSchema,
|
|
20630
20698
|
outputSchema: XcpngListVdisResultSchema,
|
|
20631
20699
|
description: "Lists VDIs on an XCP-ng host with optional filtering."
|
|
@@ -20647,7 +20715,7 @@ var XcpngFindVdiResultSchema = z.object({
|
|
|
20647
20715
|
multiple: z.boolean().optional(),
|
|
20648
20716
|
error: z.string().optional()
|
|
20649
20717
|
});
|
|
20650
|
-
async function
|
|
20718
|
+
async function run168(context) {
|
|
20651
20719
|
const params = context.params ?? {};
|
|
20652
20720
|
const {
|
|
20653
20721
|
name_label: nameLabel,
|
|
@@ -20753,7 +20821,7 @@ function buildMultipleMessage7(nameLabel, uuid, srUuid, count) {
|
|
|
20753
20821
|
const detail = identifiers.length > 0 ? identifiers.join(", ") : "specified criteria";
|
|
20754
20822
|
return `Multiple VDIs (${count}) matched ${detail}; refine filters or set allow_multiple:true.`;
|
|
20755
20823
|
}
|
|
20756
|
-
var find_vdi_default = task(
|
|
20824
|
+
var find_vdi_default = task(run168, {
|
|
20757
20825
|
inputSchema: XcpngFindVdiParamsSchema,
|
|
20758
20826
|
outputSchema: XcpngFindVdiResultSchema,
|
|
20759
20827
|
description: "Finds a single VDI on an XCP-ng host, optionally allowing multiple matches."
|
|
@@ -20768,7 +20836,7 @@ var XcpngListVbdParamsResultSchema = z.object({
|
|
|
20768
20836
|
items: z.any().optional(),
|
|
20769
20837
|
error: z.string().optional()
|
|
20770
20838
|
});
|
|
20771
|
-
async function
|
|
20839
|
+
async function run169(context) {
|
|
20772
20840
|
const filters = normalizeFilterArgs(context.params?.filters);
|
|
20773
20841
|
const result = await runXeCommand(context, "vbd-param-list", filters);
|
|
20774
20842
|
if (!result.success) {
|
|
@@ -20782,7 +20850,7 @@ async function run173(context) {
|
|
|
20782
20850
|
items: parseKeyValueOutput(result.stdout)
|
|
20783
20851
|
};
|
|
20784
20852
|
}
|
|
20785
|
-
var list_vbd_params_default = task(
|
|
20853
|
+
var list_vbd_params_default = task(run169, {
|
|
20786
20854
|
inputSchema: XcpngListVbdParamsParamsSchema,
|
|
20787
20855
|
outputSchema: XcpngListVbdParamsResultSchema,
|
|
20788
20856
|
description: "Lists virtual block devices (VBDs) on an XCP-ng host."
|
|
@@ -20797,7 +20865,7 @@ var XcpngListVbdsResultSchema = z.object({
|
|
|
20797
20865
|
items: z.array(z.any()).optional(),
|
|
20798
20866
|
error: z.string().optional()
|
|
20799
20867
|
});
|
|
20800
|
-
async function
|
|
20868
|
+
async function run170(context) {
|
|
20801
20869
|
const filters = normalizeFilterArgs(context.params?.filters);
|
|
20802
20870
|
const result = await runXeCommand(context, "vbd-list", filters);
|
|
20803
20871
|
if (!result.success) {
|
|
@@ -20847,7 +20915,7 @@ async function run174(context) {
|
|
|
20847
20915
|
items: enrichedItems
|
|
20848
20916
|
};
|
|
20849
20917
|
}
|
|
20850
|
-
var list_vbds_default = task(
|
|
20918
|
+
var list_vbds_default = task(run170, {
|
|
20851
20919
|
inputSchema: XcpngListVbdsParamsSchema,
|
|
20852
20920
|
outputSchema: XcpngListVbdsResultSchema,
|
|
20853
20921
|
description: "Lists virtual block devices (VBDs) on an XCP-ng host."
|
|
@@ -20864,7 +20932,7 @@ var XcpngListAttachedDisksResultSchema = z.object({
|
|
|
20864
20932
|
disks: z.array(z.any()).optional(),
|
|
20865
20933
|
error: z.string().optional()
|
|
20866
20934
|
});
|
|
20867
|
-
async function
|
|
20935
|
+
async function run171(context) {
|
|
20868
20936
|
const { params, error } = context;
|
|
20869
20937
|
const { vm_uuid: vmUuid, include_readonly: rawIncludeReadonly } = params ?? {};
|
|
20870
20938
|
if (!vmUuid) {
|
|
@@ -20958,7 +21026,7 @@ async function run175(context) {
|
|
|
20958
21026
|
disks
|
|
20959
21027
|
};
|
|
20960
21028
|
}
|
|
20961
|
-
var list_attached_disks_default = task(
|
|
21029
|
+
var list_attached_disks_default = task(run171, {
|
|
20962
21030
|
inputSchema: XcpngListAttachedDisksParamsSchema,
|
|
20963
21031
|
outputSchema: XcpngListAttachedDisksResultSchema,
|
|
20964
21032
|
description: "Lists VBDs attached to a VM and enriches them with VDI metadata so disks vs CD drives can be distinguished."
|
|
@@ -20985,7 +21053,7 @@ var XcpngRemoveDiskResultSchema = z.object({
|
|
|
20985
21053
|
appliedCommands: z.array(z.string()),
|
|
20986
21054
|
error: z.string().optional()
|
|
20987
21055
|
});
|
|
20988
|
-
async function
|
|
21056
|
+
async function run172(context) {
|
|
20989
21057
|
const { params, error } = context;
|
|
20990
21058
|
const {
|
|
20991
21059
|
vbd_uuid: vbdUuidParam,
|
|
@@ -21173,7 +21241,7 @@ async function waitForVdiRemoval(context, vdiUuid, timeoutMs) {
|
|
|
21173
21241
|
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
21174
21242
|
}
|
|
21175
21243
|
}
|
|
21176
|
-
var remove_disk_default = task(
|
|
21244
|
+
var remove_disk_default = task(run172, {
|
|
21177
21245
|
inputSchema: XcpngRemoveDiskParamsSchema,
|
|
21178
21246
|
outputSchema: XcpngRemoveDiskResultSchema,
|
|
21179
21247
|
description: "Detaches a VDI from a VM and optionally destroys the backing disk on XCP-ng."
|
|
@@ -21190,7 +21258,7 @@ var XcpngSetBootOrderResultSchema = z.object({
|
|
|
21190
21258
|
appliedCommands: z.array(z.string()),
|
|
21191
21259
|
error: z.string().optional()
|
|
21192
21260
|
});
|
|
21193
|
-
async function
|
|
21261
|
+
async function run173(context) {
|
|
21194
21262
|
const { params, error } = context;
|
|
21195
21263
|
const { vm_uuid, boot_order, firmware } = params;
|
|
21196
21264
|
if (!vm_uuid) {
|
|
@@ -21254,7 +21322,7 @@ async function run177(context) {
|
|
|
21254
21322
|
appliedCommands
|
|
21255
21323
|
};
|
|
21256
21324
|
}
|
|
21257
|
-
var set_boot_order_default = task(
|
|
21325
|
+
var set_boot_order_default = task(run173, {
|
|
21258
21326
|
inputSchema: XcpngSetBootOrderParamsSchema,
|
|
21259
21327
|
outputSchema: XcpngSetBootOrderResultSchema,
|
|
21260
21328
|
description: "Configures VM boot order and optional firmware mode via xe vm-param-set."
|
|
@@ -21307,7 +21375,7 @@ var OTHER_CONFIG_KEYS_TO_REMOVE = [
|
|
|
21307
21375
|
"cloud-init-hostname",
|
|
21308
21376
|
"cloud-init-instance-id"
|
|
21309
21377
|
];
|
|
21310
|
-
async function
|
|
21378
|
+
async function run174(context) {
|
|
21311
21379
|
if (!context.host) {
|
|
21312
21380
|
const message = "core.xcpng.create-template-from-vdi must run against a remote XCP-ng host.";
|
|
21313
21381
|
return {
|
|
@@ -21840,7 +21908,7 @@ async function run178(context) {
|
|
|
21840
21908
|
steps
|
|
21841
21909
|
};
|
|
21842
21910
|
}
|
|
21843
|
-
var create_template_from_vdi_default = task(
|
|
21911
|
+
var create_template_from_vdi_default = task(run174, {
|
|
21844
21912
|
inputSchema: XcpngCreateTemplateFromVdiParamsSchema,
|
|
21845
21913
|
outputSchema: XcpngCreateTemplateFromVdiResultSchema,
|
|
21846
21914
|
description: "Creates an XCP-ng template from an existing VDI by staging a VM and converting it."
|
|
@@ -21957,7 +22025,7 @@ var XcpngCreateNetworkResultSchema = z.object({
|
|
|
21957
22025
|
skipped: z.boolean().optional(),
|
|
21958
22026
|
error: z.string().optional()
|
|
21959
22027
|
});
|
|
21960
|
-
async function
|
|
22028
|
+
async function run175(context) {
|
|
21961
22029
|
const { params, error } = context;
|
|
21962
22030
|
const { name_label: nameLabel, description, bridge, mtu, tags, allow_existing: rawAllowExisting } = params ?? {};
|
|
21963
22031
|
if (!nameLabel) {
|
|
@@ -22022,7 +22090,7 @@ async function run179(context) {
|
|
|
22022
22090
|
appliedCommands
|
|
22023
22091
|
};
|
|
22024
22092
|
}
|
|
22025
|
-
var create_network_default = task(
|
|
22093
|
+
var create_network_default = task(run175, {
|
|
22026
22094
|
inputSchema: XcpngCreateNetworkParamsSchema,
|
|
22027
22095
|
outputSchema: XcpngCreateNetworkResultSchema,
|
|
22028
22096
|
description: "Creates a new network on an XCP-ng host (bridge, MTU, and tags optional)."
|
|
@@ -22054,7 +22122,7 @@ var XcpngFindOrCreateIsoSrResultSchema = z.object({
|
|
|
22054
22122
|
commands: z.array(z.string()),
|
|
22055
22123
|
error: z.string().optional()
|
|
22056
22124
|
});
|
|
22057
|
-
async function
|
|
22125
|
+
async function run176(context) {
|
|
22058
22126
|
const { params, debug, error: logError2 } = context;
|
|
22059
22127
|
const {
|
|
22060
22128
|
name_label: nameLabel,
|
|
@@ -22206,7 +22274,7 @@ async function runDirCreate(context, params) {
|
|
|
22206
22274
|
})
|
|
22207
22275
|
);
|
|
22208
22276
|
}
|
|
22209
|
-
var find_or_create_iso_sr_default = task(
|
|
22277
|
+
var find_or_create_iso_sr_default = task(run176, {
|
|
22210
22278
|
inputSchema: XcpngFindOrCreateIsoSrParamsSchema,
|
|
22211
22279
|
outputSchema: XcpngFindOrCreateIsoSrResultSchema,
|
|
22212
22280
|
description: "Finds an ISO storage repository by name, creating it if missing using xe sr-create."
|
|
@@ -22249,7 +22317,7 @@ var XcpngCreateConfigDriveResultSchema = z.object({
|
|
|
22249
22317
|
steps: z.array(z.any()),
|
|
22250
22318
|
error: z.string().optional()
|
|
22251
22319
|
});
|
|
22252
|
-
async function
|
|
22320
|
+
async function run177(context) {
|
|
22253
22321
|
if (!context.host) {
|
|
22254
22322
|
return {
|
|
22255
22323
|
success: false,
|
|
@@ -22768,7 +22836,7 @@ function decodeBase64Field(field, value) {
|
|
|
22768
22836
|
};
|
|
22769
22837
|
}
|
|
22770
22838
|
}
|
|
22771
|
-
var create_config_drive_default = task(
|
|
22839
|
+
var create_config_drive_default = task(run177, {
|
|
22772
22840
|
inputSchema: XcpngCreateConfigDriveParamsSchema,
|
|
22773
22841
|
outputSchema: XcpngCreateConfigDriveResultSchema,
|
|
22774
22842
|
description: "Generates a NoCloud config-drive ISO, stores it in an ISO SR, and returns the associated VDI."
|
|
@@ -22792,7 +22860,7 @@ var XcpngConvertTemplateToVmResultSchema = z.object({
|
|
|
22792
22860
|
alreadyVm: z.boolean().optional(),
|
|
22793
22861
|
error: z.string().optional()
|
|
22794
22862
|
});
|
|
22795
|
-
async function
|
|
22863
|
+
async function run178(context) {
|
|
22796
22864
|
const { params, error } = context;
|
|
22797
22865
|
const {
|
|
22798
22866
|
template_uuid: templateUuidParam,
|
|
@@ -22891,7 +22959,7 @@ async function run182(context) {
|
|
|
22891
22959
|
alreadyVm
|
|
22892
22960
|
};
|
|
22893
22961
|
}
|
|
22894
|
-
var convert_template_to_vm_default = task(
|
|
22962
|
+
var convert_template_to_vm_default = task(run178, {
|
|
22895
22963
|
inputSchema: XcpngConvertTemplateToVmParamsSchema,
|
|
22896
22964
|
outputSchema: XcpngConvertTemplateToVmResultSchema,
|
|
22897
22965
|
description: "Converts an XCP-ng template into a VM by clearing the template flag and optionally renaming it."
|
|
@@ -22912,7 +22980,7 @@ var XcpngDestroyIsoSrResultSchema = z.object({
|
|
|
22912
22980
|
skipped: z.boolean().optional(),
|
|
22913
22981
|
error: z.string().optional()
|
|
22914
22982
|
});
|
|
22915
|
-
async function
|
|
22983
|
+
async function run179(context) {
|
|
22916
22984
|
const { params, error } = context;
|
|
22917
22985
|
const { sr_uuid: srUuidParam, sr_name_label: srName, location, allow_missing: rawAllowMissing } = params ?? {};
|
|
22918
22986
|
const allowMissing = coerceBoolean(rawAllowMissing, false);
|
|
@@ -23078,7 +23146,7 @@ async function detachSrPbds(context, srUuid, allowMissing) {
|
|
|
23078
23146
|
}
|
|
23079
23147
|
return { commands };
|
|
23080
23148
|
}
|
|
23081
|
-
var destroy_iso_sr_default = task(
|
|
23149
|
+
var destroy_iso_sr_default = task(run179, {
|
|
23082
23150
|
inputSchema: XcpngDestroyIsoSrParamsSchema,
|
|
23083
23151
|
outputSchema: XcpngDestroyIsoSrResultSchema,
|
|
23084
23152
|
description: "Destroys an ISO storage repository and optionally removes its backing directory."
|
|
@@ -23097,7 +23165,7 @@ var XcpngDestroyBondResultSchema = z.object({
|
|
|
23097
23165
|
skipped: z.boolean().optional(),
|
|
23098
23166
|
error: z.string().optional()
|
|
23099
23167
|
});
|
|
23100
|
-
async function
|
|
23168
|
+
async function run180(context) {
|
|
23101
23169
|
const { params, error } = context;
|
|
23102
23170
|
const { bond_uuid: bondUuidParam, pif_uuid: pifUuidParam, allow_missing: rawAllowMissing } = params ?? {};
|
|
23103
23171
|
const allowMissing = coerceBoolean(rawAllowMissing, false);
|
|
@@ -23134,7 +23202,7 @@ async function run184(context) {
|
|
|
23134
23202
|
appliedCommands
|
|
23135
23203
|
};
|
|
23136
23204
|
}
|
|
23137
|
-
var destroy_bond_default = task(
|
|
23205
|
+
var destroy_bond_default = task(run180, {
|
|
23138
23206
|
inputSchema: XcpngDestroyBondParamsSchema,
|
|
23139
23207
|
outputSchema: XcpngDestroyBondResultSchema,
|
|
23140
23208
|
description: "Destroys a bonded interface, wrapping xe bond-destroy."
|
|
@@ -23156,7 +23224,7 @@ var XcpngCreateSrResultSchema = z.object({
|
|
|
23156
23224
|
skipped: z.boolean().optional(),
|
|
23157
23225
|
error: z.string().optional()
|
|
23158
23226
|
});
|
|
23159
|
-
async function
|
|
23227
|
+
async function run181(context) {
|
|
23160
23228
|
const { params, error } = context;
|
|
23161
23229
|
const {
|
|
23162
23230
|
name_label: nameLabel,
|
|
@@ -23231,7 +23299,7 @@ async function run185(context) {
|
|
|
23231
23299
|
appliedCommands
|
|
23232
23300
|
};
|
|
23233
23301
|
}
|
|
23234
|
-
var create_sr_default = task(
|
|
23302
|
+
var create_sr_default = task(run181, {
|
|
23235
23303
|
inputSchema: XcpngCreateSrParamsSchema,
|
|
23236
23304
|
outputSchema: XcpngCreateSrResultSchema,
|
|
23237
23305
|
description: "Creates a new storage repository (SR) with the specified device configuration."
|
|
@@ -23251,7 +23319,7 @@ var XcpngDestroySrResultSchema = z.object({
|
|
|
23251
23319
|
skipped: z.boolean().optional(),
|
|
23252
23320
|
error: z.string().optional()
|
|
23253
23321
|
});
|
|
23254
|
-
async function
|
|
23322
|
+
async function run182(context) {
|
|
23255
23323
|
const { params, error } = context;
|
|
23256
23324
|
const {
|
|
23257
23325
|
sr_uuid: srUuidParam,
|
|
@@ -23325,7 +23393,7 @@ async function run186(context) {
|
|
|
23325
23393
|
appliedCommands
|
|
23326
23394
|
};
|
|
23327
23395
|
}
|
|
23328
|
-
var destroy_sr_default = task(
|
|
23396
|
+
var destroy_sr_default = task(run182, {
|
|
23329
23397
|
inputSchema: XcpngDestroySrParamsSchema,
|
|
23330
23398
|
outputSchema: XcpngDestroySrResultSchema,
|
|
23331
23399
|
description: "Destroys a storage repository by UUID or name-label (optionally forcing)."
|
|
@@ -23344,7 +23412,7 @@ var XcpngDestroyNetworkResultSchema = z.object({
|
|
|
23344
23412
|
skipped: z.boolean().optional(),
|
|
23345
23413
|
error: z.string().optional()
|
|
23346
23414
|
});
|
|
23347
|
-
async function
|
|
23415
|
+
async function run183(context) {
|
|
23348
23416
|
const { params, error } = context;
|
|
23349
23417
|
const {
|
|
23350
23418
|
network_uuid: networkUuidParam,
|
|
@@ -23411,7 +23479,7 @@ async function run187(context) {
|
|
|
23411
23479
|
appliedCommands
|
|
23412
23480
|
};
|
|
23413
23481
|
}
|
|
23414
|
-
var destroy_network_default = task(
|
|
23482
|
+
var destroy_network_default = task(run183, {
|
|
23415
23483
|
inputSchema: XcpngDestroyNetworkParamsSchema,
|
|
23416
23484
|
outputSchema: XcpngDestroyNetworkResultSchema,
|
|
23417
23485
|
description: "Destroys an XCP-ng network by UUID or name-label."
|
|
@@ -23433,7 +23501,7 @@ var XcpngDestroyPbdResultSchema = z.object({
|
|
|
23433
23501
|
skipped: z.boolean().optional(),
|
|
23434
23502
|
error: z.string().optional()
|
|
23435
23503
|
});
|
|
23436
|
-
async function
|
|
23504
|
+
async function run184(context) {
|
|
23437
23505
|
const { params, error } = context;
|
|
23438
23506
|
const {
|
|
23439
23507
|
pbd_uuid: pbdUuidParam,
|
|
@@ -23542,7 +23610,7 @@ async function run188(context) {
|
|
|
23542
23610
|
appliedCommands
|
|
23543
23611
|
};
|
|
23544
23612
|
}
|
|
23545
|
-
var destroy_pbd_default = task(
|
|
23613
|
+
var destroy_pbd_default = task(run184, {
|
|
23546
23614
|
inputSchema: XcpngDestroyPbdParamsSchema,
|
|
23547
23615
|
outputSchema: XcpngDestroyPbdResultSchema,
|
|
23548
23616
|
description: "Destroys a host \u2194 storage repository binding (PBD)."
|
|
@@ -23558,7 +23626,7 @@ var XcpngDestroySnapshotResultSchema = z.object({
|
|
|
23558
23626
|
command: z.string().optional(),
|
|
23559
23627
|
error: z.string().optional()
|
|
23560
23628
|
});
|
|
23561
|
-
async function
|
|
23629
|
+
async function run185(context) {
|
|
23562
23630
|
const { params, error } = context;
|
|
23563
23631
|
const { snapshot_uuid: snapshotUuid } = params ?? {};
|
|
23564
23632
|
if (!snapshotUuid) {
|
|
@@ -23581,7 +23649,7 @@ async function run189(context) {
|
|
|
23581
23649
|
command: result.command
|
|
23582
23650
|
};
|
|
23583
23651
|
}
|
|
23584
|
-
var destroy_snapshot_default = task(
|
|
23652
|
+
var destroy_snapshot_default = task(run185, {
|
|
23585
23653
|
inputSchema: XcpngDestroySnapshotParamsSchema,
|
|
23586
23654
|
outputSchema: XcpngDestroySnapshotResultSchema,
|
|
23587
23655
|
description: "Destroys an XCP-ng VM snapshot."
|
|
@@ -23601,7 +23669,7 @@ var XcpngIntroduceSrResultSchema = z.object({
|
|
|
23601
23669
|
appliedCommands: z.array(z.string()),
|
|
23602
23670
|
error: z.string().optional()
|
|
23603
23671
|
});
|
|
23604
|
-
async function
|
|
23672
|
+
async function run186(context) {
|
|
23605
23673
|
const { params, error } = context;
|
|
23606
23674
|
const { sr_uuid: srUuid, name_label: nameLabel, type, content_type: contentType, shared } = params ?? {};
|
|
23607
23675
|
if (!srUuid) {
|
|
@@ -23642,7 +23710,7 @@ async function run190(context) {
|
|
|
23642
23710
|
appliedCommands
|
|
23643
23711
|
};
|
|
23644
23712
|
}
|
|
23645
|
-
var introduce_sr_default = task(
|
|
23713
|
+
var introduce_sr_default = task(run186, {
|
|
23646
23714
|
inputSchema: XcpngIntroduceSrParamsSchema,
|
|
23647
23715
|
outputSchema: XcpngIntroduceSrResultSchema,
|
|
23648
23716
|
description: "Introduces an existing storage repository into the pool."
|
|
@@ -23661,7 +23729,7 @@ var XcpngForgetSrResultSchema = z.object({
|
|
|
23661
23729
|
skipped: z.boolean().optional(),
|
|
23662
23730
|
error: z.string().optional()
|
|
23663
23731
|
});
|
|
23664
|
-
async function
|
|
23732
|
+
async function run187(context) {
|
|
23665
23733
|
const { params, error } = context;
|
|
23666
23734
|
const { sr_uuid: srUuidParam, sr_name_label: srNameLabel, allow_missing: rawAllowMissing } = params ?? {};
|
|
23667
23735
|
const allowMissing = coerceBoolean(rawAllowMissing, false);
|
|
@@ -23724,7 +23792,7 @@ async function run191(context) {
|
|
|
23724
23792
|
appliedCommands
|
|
23725
23793
|
};
|
|
23726
23794
|
}
|
|
23727
|
-
var forget_sr_default = task(
|
|
23795
|
+
var forget_sr_default = task(run187, {
|
|
23728
23796
|
inputSchema: XcpngForgetSrParamsSchema,
|
|
23729
23797
|
outputSchema: XcpngForgetSrResultSchema,
|
|
23730
23798
|
description: "Forgets an SR from the pool metadata without destroying the underlying storage."
|
|
@@ -23739,7 +23807,7 @@ var XcpngListSnapshotsResultSchema = z.object({
|
|
|
23739
23807
|
items: z.any().optional(),
|
|
23740
23808
|
error: z.string().optional()
|
|
23741
23809
|
});
|
|
23742
|
-
async function
|
|
23810
|
+
async function run188(context) {
|
|
23743
23811
|
const filters = normalizeFilterArgs(context.params?.filters);
|
|
23744
23812
|
const result = await runXeCommand(context, "snapshot-list", filters);
|
|
23745
23813
|
if (!result.success) {
|
|
@@ -23753,7 +23821,7 @@ async function run192(context) {
|
|
|
23753
23821
|
items: parseKeyValueOutput(result.stdout)
|
|
23754
23822
|
};
|
|
23755
23823
|
}
|
|
23756
|
-
var list_snapshots_default = task(
|
|
23824
|
+
var list_snapshots_default = task(run188, {
|
|
23757
23825
|
inputSchema: XcpngListSnapshotsParamsSchema,
|
|
23758
23826
|
outputSchema: XcpngListSnapshotsResultSchema,
|
|
23759
23827
|
description: "Lists VM snapshots available on the host."
|
|
@@ -23768,7 +23836,7 @@ var XcpngListMessagesResultSchema = z.object({
|
|
|
23768
23836
|
items: z.any().optional(),
|
|
23769
23837
|
error: z.string().optional()
|
|
23770
23838
|
});
|
|
23771
|
-
async function
|
|
23839
|
+
async function run189(context) {
|
|
23772
23840
|
const filters = normalizeFilterArgs(context.params?.filters);
|
|
23773
23841
|
const result = await runXeCommand(context, "message-list", filters);
|
|
23774
23842
|
if (!result.success) {
|
|
@@ -23782,7 +23850,7 @@ async function run193(context) {
|
|
|
23782
23850
|
items: parseKeyValueOutput(result.stdout)
|
|
23783
23851
|
};
|
|
23784
23852
|
}
|
|
23785
|
-
var list_messages_default = task(
|
|
23853
|
+
var list_messages_default = task(run189, {
|
|
23786
23854
|
inputSchema: XcpngListMessagesParamsSchema,
|
|
23787
23855
|
outputSchema: XcpngListMessagesResultSchema,
|
|
23788
23856
|
description: "Lists messages emitted by the XCP-ng pool."
|
|
@@ -23801,7 +23869,7 @@ var XcpngClearMessagesResultSchema = z.object({
|
|
|
23801
23869
|
commands: z.any().optional(),
|
|
23802
23870
|
error: z.string().optional()
|
|
23803
23871
|
});
|
|
23804
|
-
async function
|
|
23872
|
+
async function run190(context) {
|
|
23805
23873
|
const { params, error } = context;
|
|
23806
23874
|
const { uuid, uuid_prefix: uuidPrefix, all: rawAll, filters } = params ?? {};
|
|
23807
23875
|
const all = coerceBoolean(rawAll, false);
|
|
@@ -23859,7 +23927,7 @@ async function run194(context) {
|
|
|
23859
23927
|
commands
|
|
23860
23928
|
};
|
|
23861
23929
|
}
|
|
23862
|
-
var clear_messages_default = task(
|
|
23930
|
+
var clear_messages_default = task(run190, {
|
|
23863
23931
|
inputSchema: XcpngClearMessagesParamsSchema,
|
|
23864
23932
|
outputSchema: XcpngClearMessagesResultSchema,
|
|
23865
23933
|
description: "Clears messages (all, by UUID, or UUID prefix)."
|
|
@@ -23880,7 +23948,7 @@ var XcpngDestroyTemplateResultSchema = z.object({
|
|
|
23880
23948
|
skipped: z.boolean().optional(),
|
|
23881
23949
|
error: z.string().optional()
|
|
23882
23950
|
});
|
|
23883
|
-
async function
|
|
23951
|
+
async function run191(context) {
|
|
23884
23952
|
const { params, error } = context;
|
|
23885
23953
|
const {
|
|
23886
23954
|
template_uuid: templateUuidParam,
|
|
@@ -23955,7 +24023,7 @@ async function run195(context) {
|
|
|
23955
24023
|
command: commandResult.command
|
|
23956
24024
|
};
|
|
23957
24025
|
}
|
|
23958
|
-
var destroy_template_default = task(
|
|
24026
|
+
var destroy_template_default = task(run191, {
|
|
23959
24027
|
inputSchema: XcpngDestroyTemplateParamsSchema,
|
|
23960
24028
|
outputSchema: XcpngDestroyTemplateResultSchema,
|
|
23961
24029
|
description: "Destroys an XCP-ng template by UUID or name-label."
|
|
@@ -23975,7 +24043,7 @@ var XcpngDestroyVdiResultSchema = z.object({
|
|
|
23975
24043
|
skipped: z.boolean().optional(),
|
|
23976
24044
|
error: z.string().optional()
|
|
23977
24045
|
});
|
|
23978
|
-
async function
|
|
24046
|
+
async function run192(context) {
|
|
23979
24047
|
const { params, error } = context;
|
|
23980
24048
|
const {
|
|
23981
24049
|
vdi_uuid: vdiUuidParam,
|
|
@@ -24040,7 +24108,7 @@ async function run196(context) {
|
|
|
24040
24108
|
command: result.command
|
|
24041
24109
|
};
|
|
24042
24110
|
}
|
|
24043
|
-
var destroy_vdi_default = task(
|
|
24111
|
+
var destroy_vdi_default = task(run192, {
|
|
24044
24112
|
inputSchema: XcpngDestroyVdiParamsSchema,
|
|
24045
24113
|
outputSchema: XcpngDestroyVdiResultSchema,
|
|
24046
24114
|
description: "Destroys an XCP-ng VDI by UUID (optionally resolving by name-label)."
|
|
@@ -24065,7 +24133,7 @@ var XcpngDestroyVmResultSchema = z.object({
|
|
|
24065
24133
|
skipped: z.boolean().optional(),
|
|
24066
24134
|
error: z.string().optional()
|
|
24067
24135
|
});
|
|
24068
|
-
async function
|
|
24136
|
+
async function run193(context) {
|
|
24069
24137
|
const { params, error } = context;
|
|
24070
24138
|
const {
|
|
24071
24139
|
vm_uuid: vmUuidParam,
|
|
@@ -24228,7 +24296,7 @@ async function run197(context) {
|
|
|
24228
24296
|
destroyedVdiUuids
|
|
24229
24297
|
};
|
|
24230
24298
|
}
|
|
24231
|
-
var destroy_vm_default = task(
|
|
24299
|
+
var destroy_vm_default = task(run193, {
|
|
24232
24300
|
inputSchema: XcpngDestroyVmParamsSchema,
|
|
24233
24301
|
outputSchema: XcpngDestroyVmResultSchema,
|
|
24234
24302
|
description: "Destroys an XCP-ng VM, optionally forcing and pruning snapshots."
|
|
@@ -24257,7 +24325,7 @@ var XcpngCopyVdiResultSchema = z.object({
|
|
|
24257
24325
|
skipped: z.boolean().optional(),
|
|
24258
24326
|
error: z.string().optional()
|
|
24259
24327
|
});
|
|
24260
|
-
async function
|
|
24328
|
+
async function run194(context) {
|
|
24261
24329
|
const { params, error } = context;
|
|
24262
24330
|
const {
|
|
24263
24331
|
source_vdi_uuid: sourceVdiUuidParam,
|
|
@@ -24402,7 +24470,7 @@ async function run198(context) {
|
|
|
24402
24470
|
appliedCommands
|
|
24403
24471
|
};
|
|
24404
24472
|
}
|
|
24405
|
-
var copy_vdi_default = task(
|
|
24473
|
+
var copy_vdi_default = task(run194, {
|
|
24406
24474
|
inputSchema: XcpngCopyVdiParamsSchema,
|
|
24407
24475
|
outputSchema: XcpngCopyVdiResultSchema,
|
|
24408
24476
|
description: "Copies an XCP-ng VDI to a destination storage repository and optionally updates its metadata."
|
|
@@ -24420,7 +24488,7 @@ var XcpngDetachIsoResultSchema = z.object({
|
|
|
24420
24488
|
alreadyEmpty: z.boolean().optional(),
|
|
24421
24489
|
error: z.string().optional()
|
|
24422
24490
|
});
|
|
24423
|
-
async function
|
|
24491
|
+
async function run195(context) {
|
|
24424
24492
|
const { params, error } = context;
|
|
24425
24493
|
const { vm_uuid: vmUuid, allow_missing: rawAllowMissing } = params;
|
|
24426
24494
|
if (!vmUuid) {
|
|
@@ -24452,7 +24520,7 @@ async function run199(context) {
|
|
|
24452
24520
|
error: message
|
|
24453
24521
|
};
|
|
24454
24522
|
}
|
|
24455
|
-
var detach_iso_default = task(
|
|
24523
|
+
var detach_iso_default = task(run195, {
|
|
24456
24524
|
inputSchema: XcpngDetachIsoParamsSchema,
|
|
24457
24525
|
outputSchema: XcpngDetachIsoResultSchema,
|
|
24458
24526
|
description: "Ejects ISO media from a VM, tolerating empty drives when allow_missing:true."
|
|
@@ -24478,7 +24546,7 @@ var XcpngDetachVdiResultSchema = z.object({
|
|
|
24478
24546
|
appliedCommands: z.array(z.string()),
|
|
24479
24547
|
error: z.string().optional()
|
|
24480
24548
|
});
|
|
24481
|
-
async function
|
|
24549
|
+
async function run196(context) {
|
|
24482
24550
|
const { params } = context;
|
|
24483
24551
|
const {
|
|
24484
24552
|
vbd_uuid,
|
|
@@ -24515,7 +24583,7 @@ async function run200(context) {
|
|
|
24515
24583
|
error: result.error
|
|
24516
24584
|
};
|
|
24517
24585
|
}
|
|
24518
|
-
var detach_vdi_default = task(
|
|
24586
|
+
var detach_vdi_default = task(run196, {
|
|
24519
24587
|
inputSchema: XcpngDetachVdiParamsSchema,
|
|
24520
24588
|
outputSchema: XcpngDetachVdiResultSchema,
|
|
24521
24589
|
description: "Detaches a VDI from a VM by unplugging and optionally destroying the VBD, leaving the VDI intact by default."
|
|
@@ -24537,7 +24605,7 @@ var XcpngDetachNetworkInterfaceResultSchema = z.object({
|
|
|
24537
24605
|
appliedCommands: z.array(z.string()),
|
|
24538
24606
|
error: z.string().optional()
|
|
24539
24607
|
});
|
|
24540
|
-
async function
|
|
24608
|
+
async function run197(context) {
|
|
24541
24609
|
const { params, error } = context;
|
|
24542
24610
|
const {
|
|
24543
24611
|
vif_uuid: vifUuidParam,
|
|
@@ -24631,7 +24699,7 @@ async function run201(context) {
|
|
|
24631
24699
|
appliedCommands
|
|
24632
24700
|
};
|
|
24633
24701
|
}
|
|
24634
|
-
var detach_network_interface_default = task(
|
|
24702
|
+
var detach_network_interface_default = task(run197, {
|
|
24635
24703
|
inputSchema: XcpngDetachNetworkInterfaceParamsSchema,
|
|
24636
24704
|
outputSchema: XcpngDetachNetworkInterfaceResultSchema,
|
|
24637
24705
|
description: "Unplugs (and optionally destroys) a virtual network interface from an XCP-ng VM."
|
|
@@ -24651,7 +24719,7 @@ var XcpngEnableHostResultSchema = z.object({
|
|
|
24651
24719
|
skipped: z.boolean().optional(),
|
|
24652
24720
|
error: z.string().optional()
|
|
24653
24721
|
});
|
|
24654
|
-
async function
|
|
24722
|
+
async function run198(context) {
|
|
24655
24723
|
const { params, error } = context;
|
|
24656
24724
|
const {
|
|
24657
24725
|
host_uuid: hostUuidParam,
|
|
@@ -24719,7 +24787,7 @@ async function run202(context) {
|
|
|
24719
24787
|
appliedCommands
|
|
24720
24788
|
};
|
|
24721
24789
|
}
|
|
24722
|
-
var enable_host_default = task(
|
|
24790
|
+
var enable_host_default = task(run198, {
|
|
24723
24791
|
inputSchema: XcpngEnableHostParamsSchema,
|
|
24724
24792
|
outputSchema: XcpngEnableHostResultSchema,
|
|
24725
24793
|
description: "Enables maintenance-disabled hosts so they rejoin scheduling."
|
|
@@ -24741,7 +24809,7 @@ var XcpngDisableHostResultSchema = z.object({
|
|
|
24741
24809
|
evacuated: z.boolean().optional(),
|
|
24742
24810
|
error: z.string().optional()
|
|
24743
24811
|
});
|
|
24744
|
-
async function
|
|
24812
|
+
async function run199(context) {
|
|
24745
24813
|
const { params, error } = context;
|
|
24746
24814
|
const {
|
|
24747
24815
|
host_uuid: hostUuidParam,
|
|
@@ -24826,7 +24894,7 @@ async function run203(context) {
|
|
|
24826
24894
|
evacuated: evacuate
|
|
24827
24895
|
};
|
|
24828
24896
|
}
|
|
24829
|
-
var disable_host_default = task(
|
|
24897
|
+
var disable_host_default = task(run199, {
|
|
24830
24898
|
inputSchema: XcpngDisableHostParamsSchema,
|
|
24831
24899
|
outputSchema: XcpngDisableHostResultSchema,
|
|
24832
24900
|
description: "Disables a host (optionally evacuating resident VMs first)."
|
|
@@ -24846,7 +24914,7 @@ var XcpngPlugPbdResultSchema = z.object({
|
|
|
24846
24914
|
skipped: z.boolean().optional(),
|
|
24847
24915
|
error: z.string().optional()
|
|
24848
24916
|
});
|
|
24849
|
-
async function
|
|
24917
|
+
async function run200(context) {
|
|
24850
24918
|
const { params, error } = context;
|
|
24851
24919
|
const { pbd_uuid: pbdUuidParam, sr_uuid: srUuid, host_uuid: hostUuid, allow_missing: rawAllowMissing } = params ?? {};
|
|
24852
24920
|
const allowMissing = coerceBoolean(rawAllowMissing, false);
|
|
@@ -24910,7 +24978,7 @@ async function run204(context) {
|
|
|
24910
24978
|
appliedCommands
|
|
24911
24979
|
};
|
|
24912
24980
|
}
|
|
24913
|
-
var plug_pbd_default = task(
|
|
24981
|
+
var plug_pbd_default = task(run200, {
|
|
24914
24982
|
inputSchema: XcpngPlugPbdParamsSchema,
|
|
24915
24983
|
outputSchema: XcpngPlugPbdResultSchema,
|
|
24916
24984
|
description: "Plugs a PBD so the host reattaches the storage repository."
|
|
@@ -24930,7 +24998,7 @@ var XcpngUnplugPbdResultSchema = z.object({
|
|
|
24930
24998
|
skipped: z.boolean().optional(),
|
|
24931
24999
|
error: z.string().optional()
|
|
24932
25000
|
});
|
|
24933
|
-
async function
|
|
25001
|
+
async function run201(context) {
|
|
24934
25002
|
const { params, error } = context;
|
|
24935
25003
|
const { pbd_uuid: pbdUuidParam, sr_uuid: srUuid, host_uuid: hostUuid, allow_missing: rawAllowMissing } = params ?? {};
|
|
24936
25004
|
const allowMissing = coerceBoolean(rawAllowMissing, false);
|
|
@@ -24994,7 +25062,7 @@ async function run205(context) {
|
|
|
24994
25062
|
appliedCommands
|
|
24995
25063
|
};
|
|
24996
25064
|
}
|
|
24997
|
-
var unplug_pbd_default = task(
|
|
25065
|
+
var unplug_pbd_default = task(run201, {
|
|
24998
25066
|
inputSchema: XcpngUnplugPbdParamsSchema,
|
|
24999
25067
|
outputSchema: XcpngUnplugPbdResultSchema,
|
|
25000
25068
|
description: "Unplugs a PBD so the host detaches the storage repository."
|
|
@@ -25009,7 +25077,7 @@ var XcpngListPoolsResultSchema = z.object({
|
|
|
25009
25077
|
items: z.any().optional(),
|
|
25010
25078
|
error: z.string().optional()
|
|
25011
25079
|
});
|
|
25012
|
-
async function
|
|
25080
|
+
async function run202(context) {
|
|
25013
25081
|
const filters = normalizeFilterArgs(context.params?.filters);
|
|
25014
25082
|
const result = await runXeCommand(context, "pool-list", filters);
|
|
25015
25083
|
if (!result.success) {
|
|
@@ -25023,7 +25091,7 @@ async function run206(context) {
|
|
|
25023
25091
|
items: parseKeyValueOutput(result.stdout)
|
|
25024
25092
|
};
|
|
25025
25093
|
}
|
|
25026
|
-
var list_pools_default = task(
|
|
25094
|
+
var list_pools_default = task(run202, {
|
|
25027
25095
|
inputSchema: XcpngListPoolsParamsSchema,
|
|
25028
25096
|
outputSchema: XcpngListPoolsResultSchema,
|
|
25029
25097
|
description: "Lists pools available to the current host."
|
|
@@ -25044,7 +25112,7 @@ var XcpngFindPoolResultSchema = z.object({
|
|
|
25044
25112
|
multiple: z.boolean().optional(),
|
|
25045
25113
|
error: z.string().optional()
|
|
25046
25114
|
});
|
|
25047
|
-
async function
|
|
25115
|
+
async function run203(context) {
|
|
25048
25116
|
const params = context.params ?? {};
|
|
25049
25117
|
const {
|
|
25050
25118
|
uuid,
|
|
@@ -25144,7 +25212,7 @@ async function runListPools(context, params) {
|
|
|
25144
25212
|
})
|
|
25145
25213
|
);
|
|
25146
25214
|
}
|
|
25147
|
-
var find_pool_default = task(
|
|
25215
|
+
var find_pool_default = task(run203, {
|
|
25148
25216
|
inputSchema: XcpngFindPoolParamsSchema,
|
|
25149
25217
|
outputSchema: XcpngFindPoolResultSchema,
|
|
25150
25218
|
description: "Finds a single pool by UUID or name-label, optionally allowing multiple matches."
|
|
@@ -25163,7 +25231,7 @@ var XcpngSetPoolParamResultSchema = z.object({
|
|
|
25163
25231
|
appliedCommands: z.array(z.string()),
|
|
25164
25232
|
error: z.string().optional()
|
|
25165
25233
|
});
|
|
25166
|
-
async function
|
|
25234
|
+
async function run204(context) {
|
|
25167
25235
|
const { params, error } = context;
|
|
25168
25236
|
const { pool_uuid: poolUuidParam, pool_name_label: poolNameLabel, key, value } = params ?? {};
|
|
25169
25237
|
if (!key) {
|
|
@@ -25224,7 +25292,7 @@ async function run208(context) {
|
|
|
25224
25292
|
appliedCommands
|
|
25225
25293
|
};
|
|
25226
25294
|
}
|
|
25227
|
-
var set_pool_param_default = task(
|
|
25295
|
+
var set_pool_param_default = task(run204, {
|
|
25228
25296
|
inputSchema: XcpngSetPoolParamParamsSchema,
|
|
25229
25297
|
outputSchema: XcpngSetPoolParamResultSchema,
|
|
25230
25298
|
description: "Updates a pool parameter (wraps xe pool-param-set)."
|
|
@@ -25244,7 +25312,7 @@ var XcpngRebootHostResultSchema = z.object({
|
|
|
25244
25312
|
skipped: z.boolean().optional(),
|
|
25245
25313
|
error: z.string().optional()
|
|
25246
25314
|
});
|
|
25247
|
-
async function
|
|
25315
|
+
async function run205(context) {
|
|
25248
25316
|
const { params, error } = context;
|
|
25249
25317
|
const {
|
|
25250
25318
|
host_uuid: hostUuidParam,
|
|
@@ -25310,7 +25378,7 @@ async function run209(context) {
|
|
|
25310
25378
|
command: commandResult.command
|
|
25311
25379
|
};
|
|
25312
25380
|
}
|
|
25313
|
-
var reboot_host_default = task(
|
|
25381
|
+
var reboot_host_default = task(run205, {
|
|
25314
25382
|
inputSchema: XcpngRebootHostParamsSchema,
|
|
25315
25383
|
outputSchema: XcpngRebootHostResultSchema,
|
|
25316
25384
|
description: "Reboots an XCP-ng host (optionally forcing)."
|
|
@@ -25330,7 +25398,7 @@ var XcpngShutdownHostResultSchema = z.object({
|
|
|
25330
25398
|
skipped: z.boolean().optional(),
|
|
25331
25399
|
error: z.string().optional()
|
|
25332
25400
|
});
|
|
25333
|
-
async function
|
|
25401
|
+
async function run206(context) {
|
|
25334
25402
|
const { params, error } = context;
|
|
25335
25403
|
const {
|
|
25336
25404
|
host_uuid: hostUuidParam,
|
|
@@ -25394,7 +25462,7 @@ async function run210(context) {
|
|
|
25394
25462
|
command: commandResult.command
|
|
25395
25463
|
};
|
|
25396
25464
|
}
|
|
25397
|
-
var shutdown_host_default = task(
|
|
25465
|
+
var shutdown_host_default = task(run206, {
|
|
25398
25466
|
inputSchema: XcpngShutdownHostParamsSchema,
|
|
25399
25467
|
outputSchema: XcpngShutdownHostResultSchema,
|
|
25400
25468
|
description: "Shuts down an XCP-ng host (optionally forcing)."
|
|
@@ -25413,7 +25481,7 @@ var XcpngEvacuateHostResultSchema = z.object({
|
|
|
25413
25481
|
skipped: z.boolean().optional(),
|
|
25414
25482
|
error: z.string().optional()
|
|
25415
25483
|
});
|
|
25416
|
-
async function
|
|
25484
|
+
async function run207(context) {
|
|
25417
25485
|
const { params, error } = context;
|
|
25418
25486
|
const { host_uuid: hostUuidParam, host_name_label: hostNameLabel, allow_missing: rawAllowMissing } = params ?? {};
|
|
25419
25487
|
const allowMissing = coerceBoolean(rawAllowMissing, false);
|
|
@@ -25466,7 +25534,7 @@ async function run211(context) {
|
|
|
25466
25534
|
command: commandResult.command
|
|
25467
25535
|
};
|
|
25468
25536
|
}
|
|
25469
|
-
var evacuate_host_default = task(
|
|
25537
|
+
var evacuate_host_default = task(run207, {
|
|
25470
25538
|
inputSchema: XcpngEvacuateHostParamsSchema,
|
|
25471
25539
|
outputSchema: XcpngEvacuateHostResultSchema,
|
|
25472
25540
|
description: "Evacuates all VMs from a host."
|
|
@@ -25487,7 +25555,7 @@ var XcpngPlugPifResultSchema = z.object({
|
|
|
25487
25555
|
skipped: z.boolean().optional(),
|
|
25488
25556
|
error: z.string().optional()
|
|
25489
25557
|
});
|
|
25490
|
-
async function
|
|
25558
|
+
async function run208(context) {
|
|
25491
25559
|
const { params, error } = context;
|
|
25492
25560
|
const {
|
|
25493
25561
|
pif_uuid: pifUuidParam,
|
|
@@ -25584,7 +25652,7 @@ async function run212(context) {
|
|
|
25584
25652
|
appliedCommands
|
|
25585
25653
|
};
|
|
25586
25654
|
}
|
|
25587
|
-
var plug_pif_default = task(
|
|
25655
|
+
var plug_pif_default = task(run208, {
|
|
25588
25656
|
inputSchema: XcpngPlugPifParamsSchema,
|
|
25589
25657
|
outputSchema: XcpngPlugPifResultSchema,
|
|
25590
25658
|
description: "Plugs a physical interface (PIF) on the specified host."
|
|
@@ -25603,7 +25671,7 @@ var XcpngPifScanResultSchema = z.object({
|
|
|
25603
25671
|
skipped: z.boolean().optional(),
|
|
25604
25672
|
error: z.string().optional()
|
|
25605
25673
|
});
|
|
25606
|
-
async function
|
|
25674
|
+
async function run209(context) {
|
|
25607
25675
|
const { params, error } = context;
|
|
25608
25676
|
const { host_uuid: hostUuidParam, host_name_label: hostNameLabel, allow_missing: rawAllowMissing } = params ?? {};
|
|
25609
25677
|
const allowMissing = coerceBoolean(rawAllowMissing, false);
|
|
@@ -25668,7 +25736,7 @@ async function run213(context) {
|
|
|
25668
25736
|
appliedCommands
|
|
25669
25737
|
};
|
|
25670
25738
|
}
|
|
25671
|
-
var pif_scan_default = task(
|
|
25739
|
+
var pif_scan_default = task(run209, {
|
|
25672
25740
|
inputSchema: XcpngPifScanParamsSchema,
|
|
25673
25741
|
outputSchema: XcpngPifScanResultSchema,
|
|
25674
25742
|
description: "Rescans physical interfaces (PIFs) on a host to discover changes."
|
|
@@ -25689,7 +25757,7 @@ var XcpngUnplugPifResultSchema = z.object({
|
|
|
25689
25757
|
skipped: z.boolean().optional(),
|
|
25690
25758
|
error: z.string().optional()
|
|
25691
25759
|
});
|
|
25692
|
-
async function
|
|
25760
|
+
async function run210(context) {
|
|
25693
25761
|
const { params, error } = context;
|
|
25694
25762
|
const {
|
|
25695
25763
|
pif_uuid: pifUuidParam,
|
|
@@ -25786,7 +25854,7 @@ async function run214(context) {
|
|
|
25786
25854
|
appliedCommands
|
|
25787
25855
|
};
|
|
25788
25856
|
}
|
|
25789
|
-
var unplug_pif_default = task(
|
|
25857
|
+
var unplug_pif_default = task(run210, {
|
|
25790
25858
|
inputSchema: XcpngUnplugPifParamsSchema,
|
|
25791
25859
|
outputSchema: XcpngUnplugPifResultSchema,
|
|
25792
25860
|
description: "Unplugs a physical interface (PIF) on the specified host."
|
|
@@ -25804,7 +25872,7 @@ var XcpngSetPifParamResultSchema = z.object({
|
|
|
25804
25872
|
command: z.string().optional(),
|
|
25805
25873
|
error: z.string().optional()
|
|
25806
25874
|
});
|
|
25807
|
-
async function
|
|
25875
|
+
async function run211(context) {
|
|
25808
25876
|
const { params, error } = context;
|
|
25809
25877
|
const { pif_uuid: pifUuid, key, value } = params ?? {};
|
|
25810
25878
|
if (!pifUuid) {
|
|
@@ -25842,7 +25910,7 @@ async function run215(context) {
|
|
|
25842
25910
|
command: commandResult.command
|
|
25843
25911
|
};
|
|
25844
25912
|
}
|
|
25845
|
-
var set_pif_param_default = task(
|
|
25913
|
+
var set_pif_param_default = task(run211, {
|
|
25846
25914
|
inputSchema: XcpngSetPifParamParamsSchema,
|
|
25847
25915
|
outputSchema: XcpngSetPifParamResultSchema,
|
|
25848
25916
|
description: "Updates a PIF parameter (wraps `xe pif-param-set`)."
|
|
@@ -25859,7 +25927,7 @@ var XcpngUnplugVbdResultSchema = z.object({
|
|
|
25859
25927
|
alreadyDetached: z.boolean().optional(),
|
|
25860
25928
|
error: z.string().optional()
|
|
25861
25929
|
});
|
|
25862
|
-
async function
|
|
25930
|
+
async function run212(context) {
|
|
25863
25931
|
const { params, error } = context;
|
|
25864
25932
|
const { vbd_uuid: vbdUuid, allow_missing: rawAllowMissing } = params;
|
|
25865
25933
|
if (!vbdUuid) {
|
|
@@ -25889,7 +25957,7 @@ async function run216(context) {
|
|
|
25889
25957
|
error: message
|
|
25890
25958
|
};
|
|
25891
25959
|
}
|
|
25892
|
-
var unplug_vbd_default = task(
|
|
25960
|
+
var unplug_vbd_default = task(run212, {
|
|
25893
25961
|
inputSchema: XcpngUnplugVbdParamsSchema,
|
|
25894
25962
|
outputSchema: XcpngUnplugVbdResultSchema,
|
|
25895
25963
|
description: "Unplugs a VBD from an XCP-ng VM, tolerating already-detached devices when allow_missing:true."
|
|
@@ -25909,7 +25977,7 @@ var XcpngSuspendVmResultSchema = z.object({
|
|
|
25909
25977
|
waitAttempts: z.number().optional(),
|
|
25910
25978
|
error: z.string().optional()
|
|
25911
25979
|
});
|
|
25912
|
-
async function
|
|
25980
|
+
async function run213(context) {
|
|
25913
25981
|
const { params, error } = context;
|
|
25914
25982
|
const { vm_uuid: vmUuid, allow_running: rawAllowRunning } = params;
|
|
25915
25983
|
if (!vmUuid) {
|
|
@@ -25970,7 +26038,7 @@ async function run217(context) {
|
|
|
25970
26038
|
waitAttempts: waitResult.attempts
|
|
25971
26039
|
};
|
|
25972
26040
|
}
|
|
25973
|
-
var suspend_vm_default = task(
|
|
26041
|
+
var suspend_vm_default = task(run213, {
|
|
25974
26042
|
inputSchema: XcpngSuspendVmParamsSchema,
|
|
25975
26043
|
outputSchema: XcpngSuspendVmResultSchema,
|
|
25976
26044
|
description: "Suspends an XCP-ng VM, waiting until the VM reports the suspended power state."
|
|
@@ -25991,7 +26059,7 @@ var XcpngResumeVmResultSchema = z.object({
|
|
|
25991
26059
|
waitAttempts: z.number().optional(),
|
|
25992
26060
|
error: z.string().optional()
|
|
25993
26061
|
});
|
|
25994
|
-
async function
|
|
26062
|
+
async function run214(context) {
|
|
25995
26063
|
const { params, error } = context;
|
|
25996
26064
|
const { vm_uuid: vmUuid, start_paused: rawStartPaused, host_uuid: hostUuid } = params;
|
|
25997
26065
|
if (!vmUuid) {
|
|
@@ -26056,7 +26124,7 @@ async function run218(context) {
|
|
|
26056
26124
|
waitAttempts: waitResult.attempts
|
|
26057
26125
|
};
|
|
26058
26126
|
}
|
|
26059
|
-
var resume_vm_default = task(
|
|
26127
|
+
var resume_vm_default = task(run214, {
|
|
26060
26128
|
inputSchema: XcpngResumeVmParamsSchema,
|
|
26061
26129
|
outputSchema: XcpngResumeVmResultSchema,
|
|
26062
26130
|
description: "Resumes a suspended XCP-ng VM, optionally starting it in a paused state or on a specific host."
|
|
@@ -26071,7 +26139,7 @@ var XcpngListVifParamsResultSchema = z.object({
|
|
|
26071
26139
|
items: z.any().optional(),
|
|
26072
26140
|
error: z.string().optional()
|
|
26073
26141
|
});
|
|
26074
|
-
async function
|
|
26142
|
+
async function run215(context) {
|
|
26075
26143
|
const filters = normalizeFilterArgs(context.params?.filters);
|
|
26076
26144
|
const result = await runXeCommand(context, "vif-param-list", filters);
|
|
26077
26145
|
if (!result.success) {
|
|
@@ -26085,7 +26153,7 @@ async function run219(context) {
|
|
|
26085
26153
|
items: parseKeyValueOutput(result.stdout)
|
|
26086
26154
|
};
|
|
26087
26155
|
}
|
|
26088
|
-
var list_vif_params_default = task(
|
|
26156
|
+
var list_vif_params_default = task(run215, {
|
|
26089
26157
|
inputSchema: XcpngListVifParamsParamsSchema,
|
|
26090
26158
|
outputSchema: XcpngListVifParamsResultSchema,
|
|
26091
26159
|
description: "Lists parameters for virtual interfaces (VIFs) on an XCP-ng host."
|
|
@@ -26100,7 +26168,7 @@ var XcpngListVifsResultSchema = z.object({
|
|
|
26100
26168
|
items: z.array(z.any()).optional(),
|
|
26101
26169
|
error: z.string().optional()
|
|
26102
26170
|
});
|
|
26103
|
-
async function
|
|
26171
|
+
async function run216(context) {
|
|
26104
26172
|
const filters = normalizeFilterArgs(context.params?.filters);
|
|
26105
26173
|
const result = await runXeCommand(context, "vif-list", filters);
|
|
26106
26174
|
if (!result.success) {
|
|
@@ -26148,7 +26216,7 @@ async function run220(context) {
|
|
|
26148
26216
|
items: enrichedItems
|
|
26149
26217
|
};
|
|
26150
26218
|
}
|
|
26151
|
-
var list_vifs_default = task(
|
|
26219
|
+
var list_vifs_default = task(run216, {
|
|
26152
26220
|
inputSchema: XcpngListVifsParamsSchema,
|
|
26153
26221
|
outputSchema: XcpngListVifsResultSchema,
|
|
26154
26222
|
description: "Lists VIFs (virtual interfaces) attached to VMs."
|
|
@@ -26163,7 +26231,7 @@ var XcpngListPifParamsResultSchema = z.object({
|
|
|
26163
26231
|
items: z.any().optional(),
|
|
26164
26232
|
error: z.string().optional()
|
|
26165
26233
|
});
|
|
26166
|
-
async function
|
|
26234
|
+
async function run217(context) {
|
|
26167
26235
|
const filters = normalizeFilterArgs(context.params?.filters);
|
|
26168
26236
|
const result = await runXeCommand(context, "pif-param-list", filters);
|
|
26169
26237
|
if (!result.success) {
|
|
@@ -26177,7 +26245,7 @@ async function run221(context) {
|
|
|
26177
26245
|
items: parseKeyValueOutput(result.stdout)
|
|
26178
26246
|
};
|
|
26179
26247
|
}
|
|
26180
|
-
var list_pif_params_default = task(
|
|
26248
|
+
var list_pif_params_default = task(run217, {
|
|
26181
26249
|
inputSchema: XcpngListPifParamsParamsSchema,
|
|
26182
26250
|
outputSchema: XcpngListPifParamsResultSchema,
|
|
26183
26251
|
description: "Lists parameters for PIFs on an XCP-ng host."
|
|
@@ -26192,7 +26260,7 @@ var XcpngListPifsResultSchema = z.object({
|
|
|
26192
26260
|
items: z.array(z.any()).optional(),
|
|
26193
26261
|
error: z.string().optional()
|
|
26194
26262
|
});
|
|
26195
|
-
async function
|
|
26263
|
+
async function run218(context) {
|
|
26196
26264
|
const filters = normalizeFilterArgs(context.params?.filters);
|
|
26197
26265
|
const result = await runXeCommand(context, "pif-list", filters);
|
|
26198
26266
|
if (!result.success) {
|
|
@@ -26240,7 +26308,7 @@ async function run222(context) {
|
|
|
26240
26308
|
items: enrichedItems
|
|
26241
26309
|
};
|
|
26242
26310
|
}
|
|
26243
|
-
var list_pifs_default = task(
|
|
26311
|
+
var list_pifs_default = task(run218, {
|
|
26244
26312
|
inputSchema: XcpngListPifsParamsSchema,
|
|
26245
26313
|
outputSchema: XcpngListPifsResultSchema,
|
|
26246
26314
|
description: "Lists PIFs (physical interfaces) available on the XCP-ng host."
|
|
@@ -26260,7 +26328,7 @@ var XcpngRebootVmResultSchema = z.object({
|
|
|
26260
26328
|
powerState: z.string().optional(),
|
|
26261
26329
|
waitAttempts: z.number().optional()
|
|
26262
26330
|
});
|
|
26263
|
-
async function
|
|
26331
|
+
async function run219(context) {
|
|
26264
26332
|
const { params, error } = context;
|
|
26265
26333
|
const { vm_uuid: vmUuidParam, vm_name_label: vmNameLabel, force: rawForce } = params ?? {};
|
|
26266
26334
|
const force = coerceBoolean(rawForce, false);
|
|
@@ -26321,7 +26389,7 @@ async function run223(context) {
|
|
|
26321
26389
|
waitAttempts: waitResult.attempts
|
|
26322
26390
|
};
|
|
26323
26391
|
}
|
|
26324
|
-
var reboot_vm_default = task(
|
|
26392
|
+
var reboot_vm_default = task(run219, {
|
|
26325
26393
|
inputSchema: XcpngRebootVmParamsSchema,
|
|
26326
26394
|
outputSchema: XcpngRebootVmResultSchema,
|
|
26327
26395
|
description: "Reboots an XCP-ng VM using `xe vm-reboot`."
|
|
@@ -26340,7 +26408,7 @@ var XcpngSetNetworkParamResultSchema = z.object({
|
|
|
26340
26408
|
appliedCommands: z.array(z.string()),
|
|
26341
26409
|
error: z.string().optional()
|
|
26342
26410
|
});
|
|
26343
|
-
async function
|
|
26411
|
+
async function run220(context) {
|
|
26344
26412
|
const { params, error } = context;
|
|
26345
26413
|
const { network_uuid: networkUuidParam, network_name_label: networkNameLabel, key, value } = params ?? {};
|
|
26346
26414
|
if (!key) {
|
|
@@ -26401,7 +26469,7 @@ async function run224(context) {
|
|
|
26401
26469
|
appliedCommands
|
|
26402
26470
|
};
|
|
26403
26471
|
}
|
|
26404
|
-
var set_network_param_default = task(
|
|
26472
|
+
var set_network_param_default = task(run220, {
|
|
26405
26473
|
inputSchema: XcpngSetNetworkParamParamsSchema,
|
|
26406
26474
|
outputSchema: XcpngSetNetworkParamResultSchema,
|
|
26407
26475
|
description: "Updates a network parameter (wraps xe network-param-set)."
|
|
@@ -26425,7 +26493,7 @@ var XcpngResizeVdiResultSchema = z.object({
|
|
|
26425
26493
|
newSizeBytes: z.number().optional(),
|
|
26426
26494
|
error: z.string().optional()
|
|
26427
26495
|
});
|
|
26428
|
-
async function
|
|
26496
|
+
async function run221(context) {
|
|
26429
26497
|
const { params, error } = context;
|
|
26430
26498
|
const {
|
|
26431
26499
|
vdi_uuid: vdiUuidParam,
|
|
@@ -26499,7 +26567,7 @@ async function run225(context) {
|
|
|
26499
26567
|
newSizeBytes: sizeBytes
|
|
26500
26568
|
};
|
|
26501
26569
|
}
|
|
26502
|
-
var resize_vdi_default = task(
|
|
26570
|
+
var resize_vdi_default = task(run221, {
|
|
26503
26571
|
inputSchema: XcpngResizeVdiParamsSchema,
|
|
26504
26572
|
outputSchema: XcpngResizeVdiResultSchema,
|
|
26505
26573
|
description: "Resizes an existing VDI on XCP-ng using `xe vdi-resize`/`vdi-resize-online`."
|
|
@@ -26531,7 +26599,7 @@ var XcpngSetVmResourcesResultSchema = z.object({
|
|
|
26531
26599
|
powerState: z.string().optional(),
|
|
26532
26600
|
waitAttempts: z.number().optional()
|
|
26533
26601
|
});
|
|
26534
|
-
async function
|
|
26602
|
+
async function run222(context) {
|
|
26535
26603
|
const { params, error } = context;
|
|
26536
26604
|
const {
|
|
26537
26605
|
vm_uuid: vmUuidParam,
|
|
@@ -26779,14 +26847,14 @@ async function run226(context) {
|
|
|
26779
26847
|
cpuUpdates.push({ field, value });
|
|
26780
26848
|
}
|
|
26781
26849
|
}
|
|
26782
|
-
for (const
|
|
26850
|
+
for (const update of cpuUpdates) {
|
|
26783
26851
|
const result = await runXeCommand(context, "vm-param-set", {
|
|
26784
26852
|
uuid: vmUuid,
|
|
26785
|
-
[
|
|
26853
|
+
[update.field]: update.value
|
|
26786
26854
|
});
|
|
26787
26855
|
appliedCommands.push(result.command);
|
|
26788
26856
|
if (!result.success) {
|
|
26789
|
-
const message = xeErrorMessage(result, `xe vm-param-set (${
|
|
26857
|
+
const message = xeErrorMessage(result, `xe vm-param-set (${update.field}) failed`);
|
|
26790
26858
|
error(message);
|
|
26791
26859
|
return {
|
|
26792
26860
|
success: false,
|
|
@@ -26834,7 +26902,7 @@ function ensurePositiveMib(value, fieldName) {
|
|
|
26834
26902
|
bytes: mibToBytes2(value)
|
|
26835
26903
|
};
|
|
26836
26904
|
}
|
|
26837
|
-
var set_vm_resources_default = task(
|
|
26905
|
+
var set_vm_resources_default = task(run222, {
|
|
26838
26906
|
inputSchema: XcpngSetVmResourcesParamsSchema,
|
|
26839
26907
|
outputSchema: XcpngSetVmResourcesResultSchema,
|
|
26840
26908
|
description: "Updates VM memory and vCPU settings on an XCP-ng host."
|
|
@@ -26859,7 +26927,7 @@ var XcpngResizeVmCpusResultSchema = z.object({
|
|
|
26859
26927
|
powerState: z.string().optional(),
|
|
26860
26928
|
waitAttempts: z.number().optional()
|
|
26861
26929
|
});
|
|
26862
|
-
async function
|
|
26930
|
+
async function run223(context) {
|
|
26863
26931
|
const { params, error } = context;
|
|
26864
26932
|
const {
|
|
26865
26933
|
vm_uuid: vmUuid,
|
|
@@ -26908,7 +26976,7 @@ async function run227(context) {
|
|
|
26908
26976
|
waitAttempts: result.waitAttempts
|
|
26909
26977
|
};
|
|
26910
26978
|
}
|
|
26911
|
-
var resize_vm_cpus_default = task(
|
|
26979
|
+
var resize_vm_cpus_default = task(run223, {
|
|
26912
26980
|
inputSchema: XcpngResizeVmCpusParamsSchema,
|
|
26913
26981
|
outputSchema: XcpngResizeVmCpusResultSchema,
|
|
26914
26982
|
description: "Resizes an XCP-ng VM\u2019s vCPU configuration."
|
|
@@ -26929,7 +26997,7 @@ var XcpngResizeVmMemoryResultSchema = z.object({
|
|
|
26929
26997
|
powerState: z.string().optional(),
|
|
26930
26998
|
waitAttempts: z.number().optional()
|
|
26931
26999
|
});
|
|
26932
|
-
async function
|
|
27000
|
+
async function run224(context) {
|
|
26933
27001
|
const { params, error } = context;
|
|
26934
27002
|
const { vm_uuid: vmUuid, vm_name_label: vmNameLabel, memory_mib: memoryMib } = params ?? {};
|
|
26935
27003
|
if (!memoryMib || !Number.isFinite(memoryMib) || memoryMib <= 0) {
|
|
@@ -26968,7 +27036,7 @@ async function run228(context) {
|
|
|
26968
27036
|
waitAttempts: result.waitAttempts
|
|
26969
27037
|
};
|
|
26970
27038
|
}
|
|
26971
|
-
var resize_vm_memory_default = task(
|
|
27039
|
+
var resize_vm_memory_default = task(run224, {
|
|
26972
27040
|
inputSchema: XcpngResizeVmMemoryParamsSchema,
|
|
26973
27041
|
outputSchema: XcpngResizeVmMemoryResultSchema,
|
|
26974
27042
|
description: "Resizes an XCP-ng VM\u2019s memory allocation (static/dynamic bounds)."
|
|
@@ -26987,7 +27055,7 @@ var XcpngRevertSnapshotResultSchema = z.object({
|
|
|
26987
27055
|
powerState: z.string().optional(),
|
|
26988
27056
|
waitAttempts: z.number().optional()
|
|
26989
27057
|
});
|
|
26990
|
-
async function
|
|
27058
|
+
async function run225(context) {
|
|
26991
27059
|
const { params, error } = context;
|
|
26992
27060
|
const { snapshot_uuid: snapshotUuid } = params ?? {};
|
|
26993
27061
|
if (!snapshotUuid) {
|
|
@@ -27076,7 +27144,7 @@ async function run229(context) {
|
|
|
27076
27144
|
waitAttempts
|
|
27077
27145
|
};
|
|
27078
27146
|
}
|
|
27079
|
-
var revert_snapshot_default = task(
|
|
27147
|
+
var revert_snapshot_default = task(run225, {
|
|
27080
27148
|
inputSchema: XcpngRevertSnapshotParamsSchema,
|
|
27081
27149
|
outputSchema: XcpngRevertSnapshotResultSchema,
|
|
27082
27150
|
description: "Reverts an XCP-ng VM to a specified snapshot."
|
|
@@ -27094,7 +27162,7 @@ var XcpngSetSnapshotParamResultSchema = z.object({
|
|
|
27094
27162
|
command: z.string().optional(),
|
|
27095
27163
|
error: z.string().optional()
|
|
27096
27164
|
});
|
|
27097
|
-
async function
|
|
27165
|
+
async function run226(context) {
|
|
27098
27166
|
const { params, error } = context;
|
|
27099
27167
|
const { snapshot_uuid: snapshotUuid, key, value } = params ?? {};
|
|
27100
27168
|
if (!snapshotUuid) {
|
|
@@ -27132,7 +27200,7 @@ async function run230(context) {
|
|
|
27132
27200
|
command: commandResult.command
|
|
27133
27201
|
};
|
|
27134
27202
|
}
|
|
27135
|
-
var set_snapshot_param_default = task(
|
|
27203
|
+
var set_snapshot_param_default = task(run226, {
|
|
27136
27204
|
inputSchema: XcpngSetSnapshotParamParamsSchema,
|
|
27137
27205
|
outputSchema: XcpngSetSnapshotParamResultSchema,
|
|
27138
27206
|
description: "Updates a snapshot parameter (wraps xe snapshot-param-set)."
|
|
@@ -27151,7 +27219,7 @@ var XcpngSetSrParamResultSchema = z.object({
|
|
|
27151
27219
|
appliedCommands: z.array(z.string()),
|
|
27152
27220
|
error: z.string().optional()
|
|
27153
27221
|
});
|
|
27154
|
-
async function
|
|
27222
|
+
async function run227(context) {
|
|
27155
27223
|
const { params, error } = context;
|
|
27156
27224
|
const { sr_uuid: srUuidParam, sr_name_label: srNameLabel, key, value } = params ?? {};
|
|
27157
27225
|
if (!key) {
|
|
@@ -27212,7 +27280,7 @@ async function run231(context) {
|
|
|
27212
27280
|
appliedCommands
|
|
27213
27281
|
};
|
|
27214
27282
|
}
|
|
27215
|
-
var set_sr_param_default = task(
|
|
27283
|
+
var set_sr_param_default = task(run227, {
|
|
27216
27284
|
inputSchema: XcpngSetSrParamParamsSchema,
|
|
27217
27285
|
outputSchema: XcpngSetSrParamResultSchema,
|
|
27218
27286
|
description: "Updates a storage repository parameter (wraps xe sr-param-set)."
|
|
@@ -27233,7 +27301,7 @@ var XcpngStartVmResultSchema = z.object({
|
|
|
27233
27301
|
finalPowerState: z.string().optional(),
|
|
27234
27302
|
waitAttempts: z.number().optional()
|
|
27235
27303
|
});
|
|
27236
|
-
async function
|
|
27304
|
+
async function run228(context) {
|
|
27237
27305
|
const { params, error } = context;
|
|
27238
27306
|
const { vm_uuid, start_paused: rawStartPaused, force: rawForce } = params;
|
|
27239
27307
|
const startPaused = coerceBoolean(rawStartPaused, false);
|
|
@@ -27300,7 +27368,7 @@ async function run232(context) {
|
|
|
27300
27368
|
waitAttempts: waitResult.attempts
|
|
27301
27369
|
};
|
|
27302
27370
|
}
|
|
27303
|
-
var start_vm_default = task(
|
|
27371
|
+
var start_vm_default = task(run228, {
|
|
27304
27372
|
inputSchema: XcpngStartVmParamsSchema,
|
|
27305
27373
|
outputSchema: XcpngStartVmResultSchema,
|
|
27306
27374
|
description: "Starts an XCP-ng virtual machine with optional paused or forced modes."
|
|
@@ -27321,7 +27389,7 @@ var XcpngStopVmResultSchema = z.object({
|
|
|
27321
27389
|
finalPowerState: z.string().optional(),
|
|
27322
27390
|
waitAttempts: z.number().optional()
|
|
27323
27391
|
});
|
|
27324
|
-
async function
|
|
27392
|
+
async function run229(context) {
|
|
27325
27393
|
const { params, error } = context;
|
|
27326
27394
|
const { vm_uuid, force: rawForce, timeout_seconds: rawTimeout } = params;
|
|
27327
27395
|
const force = coerceBoolean(rawForce, false);
|
|
@@ -27396,7 +27464,7 @@ async function run233(context) {
|
|
|
27396
27464
|
waitAttempts: waitResult.attempts
|
|
27397
27465
|
};
|
|
27398
27466
|
}
|
|
27399
|
-
var stop_vm_default = task(
|
|
27467
|
+
var stop_vm_default = task(run229, {
|
|
27400
27468
|
inputSchema: XcpngStopVmParamsSchema,
|
|
27401
27469
|
outputSchema: XcpngStopVmResultSchema,
|
|
27402
27470
|
description: "Stops an XCP-ng virtual machine gracefully or forcefully."
|
|
@@ -27425,7 +27493,7 @@ var XcpngImportIsoResultSchema = z.object({
|
|
|
27425
27493
|
commands: z.array(z.string()),
|
|
27426
27494
|
error: z.string().optional()
|
|
27427
27495
|
});
|
|
27428
|
-
async function
|
|
27496
|
+
async function run230(context) {
|
|
27429
27497
|
if (!context.host) {
|
|
27430
27498
|
return {
|
|
27431
27499
|
success: false,
|
|
@@ -27631,7 +27699,7 @@ async function findIsoVdi2(context, srUuid, isoFileName) {
|
|
|
27631
27699
|
}
|
|
27632
27700
|
return { vdi };
|
|
27633
27701
|
}
|
|
27634
|
-
var import_iso_default = task(
|
|
27702
|
+
var import_iso_default = task(run230, {
|
|
27635
27703
|
inputSchema: XcpngImportIsoParamsSchema,
|
|
27636
27704
|
outputSchema: XcpngImportIsoResultSchema,
|
|
27637
27705
|
description: "Ensures an ISO file is represented as a VDI in an ISO SR by rescanning and importing when necessary."
|
|
@@ -27639,7 +27707,7 @@ var import_iso_default = task(run234, {
|
|
|
27639
27707
|
|
|
27640
27708
|
// src/core/xcpng/upload-iso.ts
|
|
27641
27709
|
import { basename, posix as pathPosix3 } from "path";
|
|
27642
|
-
import { createReadStream, promises as
|
|
27710
|
+
import { createReadStream, promises as fs9 } from "fs";
|
|
27643
27711
|
var DEFAULT_ISO_SR_PATH3 = "/var/opt/xen/iso-sr";
|
|
27644
27712
|
var XcpngUploadIsoParamsSchema = z.object({
|
|
27645
27713
|
source_path: z.string(),
|
|
@@ -27660,7 +27728,7 @@ var XcpngUploadIsoHostResultSchema = z.object({
|
|
|
27660
27728
|
remotePath: z.string().optional(),
|
|
27661
27729
|
error: z.string().optional()
|
|
27662
27730
|
});
|
|
27663
|
-
async function
|
|
27731
|
+
async function run231(context) {
|
|
27664
27732
|
if (context.host) {
|
|
27665
27733
|
return {
|
|
27666
27734
|
success: false,
|
|
@@ -27696,7 +27764,7 @@ async function run235(context) {
|
|
|
27696
27764
|
const resolvedLocation = location ?? DEFAULT_ISO_SR_PATH3;
|
|
27697
27765
|
const remoteFileName = filename ?? basename(sourcePath);
|
|
27698
27766
|
try {
|
|
27699
|
-
const stats = await
|
|
27767
|
+
const stats = await fs9.stat(sourcePath);
|
|
27700
27768
|
if (!stats.isFile()) {
|
|
27701
27769
|
return {
|
|
27702
27770
|
success: false,
|
|
@@ -27715,10 +27783,10 @@ async function run235(context) {
|
|
|
27715
27783
|
const uploads = await context.ssh(
|
|
27716
27784
|
[],
|
|
27717
27785
|
async (remoteContext) => {
|
|
27718
|
-
const { run:
|
|
27786
|
+
const { run: run249 } = remoteContext;
|
|
27719
27787
|
const remotePath = pathPosix3.join(resolvedLocation, remoteFileName);
|
|
27720
27788
|
try {
|
|
27721
|
-
const srResult = await
|
|
27789
|
+
const srResult = await run249(
|
|
27722
27790
|
find_or_create_iso_sr_default({
|
|
27723
27791
|
name_label: isoSrName,
|
|
27724
27792
|
location: resolvedLocation,
|
|
@@ -27735,7 +27803,7 @@ async function run235(context) {
|
|
|
27735
27803
|
error: srResult.error ?? "Failed to ensure ISO SR exists."
|
|
27736
27804
|
};
|
|
27737
27805
|
}
|
|
27738
|
-
const fileExistsResult = await
|
|
27806
|
+
const fileExistsResult = await run249(exists_default2({ path: remotePath }));
|
|
27739
27807
|
if (fileExistsResult.exists) {
|
|
27740
27808
|
return {
|
|
27741
27809
|
success: true,
|
|
@@ -27802,7 +27870,7 @@ function resolveChunkSizeBytes(chunkSizeMb) {
|
|
|
27802
27870
|
const bounded = Math.min(Math.max(safeSize, MIN_CHUNK_SIZE_MB), MAX_CHUNK_SIZE_MB);
|
|
27803
27871
|
return bounded * 1024 * 1024;
|
|
27804
27872
|
}
|
|
27805
|
-
var upload_iso_default = task(
|
|
27873
|
+
var upload_iso_default = task(run231, {
|
|
27806
27874
|
inputSchema: XcpngUploadIsoParamsSchema,
|
|
27807
27875
|
outputSchema: XcpngUploadIsoHostResultSchema,
|
|
27808
27876
|
description: "Uploads a local ISO to the remote XCP-ng hypervisor, ensuring the target ISO SR exists beforehand."
|
|
@@ -27839,7 +27907,7 @@ function parseMapValue(raw) {
|
|
|
27839
27907
|
return acc;
|
|
27840
27908
|
}, {});
|
|
27841
27909
|
}
|
|
27842
|
-
async function
|
|
27910
|
+
async function run232(context) {
|
|
27843
27911
|
const { params, error } = context;
|
|
27844
27912
|
const {
|
|
27845
27913
|
vm_uuid: vmUuidParam,
|
|
@@ -27977,7 +28045,7 @@ async function run236(context) {
|
|
|
27977
28045
|
}
|
|
27978
28046
|
return result;
|
|
27979
28047
|
}
|
|
27980
|
-
var get_vm_info_default = task(
|
|
28048
|
+
var get_vm_info_default = task(run232, {
|
|
27981
28049
|
inputSchema: XcpngGetVmInfoParamsSchema,
|
|
27982
28050
|
outputSchema: XcpngGetVmInfoResultSchema,
|
|
27983
28051
|
description: "Returns structured VM details (platform, boot configuration, memory/CPU sizing, and optional VBD/VIF inventory)."
|
|
@@ -28001,7 +28069,7 @@ var XcpngExportVdiResultSchema = z.object({
|
|
|
28001
28069
|
skipped: z.boolean().optional(),
|
|
28002
28070
|
error: z.string().optional()
|
|
28003
28071
|
});
|
|
28004
|
-
async function
|
|
28072
|
+
async function run233(context) {
|
|
28005
28073
|
const { params, error } = context;
|
|
28006
28074
|
const {
|
|
28007
28075
|
vdi_uuid: vdiUuidParam,
|
|
@@ -28081,7 +28149,7 @@ async function run237(context) {
|
|
|
28081
28149
|
appliedCommands
|
|
28082
28150
|
};
|
|
28083
28151
|
}
|
|
28084
|
-
var export_vdi_default = task(
|
|
28152
|
+
var export_vdi_default = task(run233, {
|
|
28085
28153
|
inputSchema: XcpngExportVdiParamsSchema,
|
|
28086
28154
|
outputSchema: XcpngExportVdiResultSchema,
|
|
28087
28155
|
description: "Exports a VDI to the hypervisor filesystem via xe vdi-export."
|
|
@@ -28135,7 +28203,7 @@ var XcpngProvisionVmFromIsoResultSchema = z.object({
|
|
|
28135
28203
|
steps: z.array(z.any()),
|
|
28136
28204
|
error: z.string().optional()
|
|
28137
28205
|
});
|
|
28138
|
-
async function
|
|
28206
|
+
async function run234(context) {
|
|
28139
28207
|
if (!context.host) {
|
|
28140
28208
|
return {
|
|
28141
28209
|
success: false,
|
|
@@ -28462,7 +28530,7 @@ async function run238(context) {
|
|
|
28462
28530
|
steps
|
|
28463
28531
|
};
|
|
28464
28532
|
}
|
|
28465
|
-
var provision_vm_from_iso_default = task(
|
|
28533
|
+
var provision_vm_from_iso_default = task(run234, {
|
|
28466
28534
|
inputSchema: XcpngProvisionVmFromIsoParamsSchema,
|
|
28467
28535
|
outputSchema: XcpngProvisionVmFromIsoResultSchema,
|
|
28468
28536
|
description: "Creates a VM from a template, attaches storage, network, and ISO media, and optionally boots it for installation."
|
|
@@ -29492,7 +29560,7 @@ function resolveMemoryMib(input) {
|
|
|
29492
29560
|
}
|
|
29493
29561
|
return { value: Math.floor(value) };
|
|
29494
29562
|
}
|
|
29495
|
-
async function
|
|
29563
|
+
async function run235(context) {
|
|
29496
29564
|
if (!context.host) {
|
|
29497
29565
|
return runLocal(context);
|
|
29498
29566
|
}
|
|
@@ -29705,7 +29773,7 @@ function buildLocalFailure(step, message) {
|
|
|
29705
29773
|
error: message
|
|
29706
29774
|
};
|
|
29707
29775
|
}
|
|
29708
|
-
var provision_vm_default = task(
|
|
29776
|
+
var provision_vm_default = task(run235, {
|
|
29709
29777
|
inputSchema: XcpngProvisionVmParamsSchema,
|
|
29710
29778
|
outputSchema: XcpngProvisionVmResultSchema,
|
|
29711
29779
|
description: "Provisions a VM from an XCP-ng template by cloning its root disk, configuring cloud-init metadata, and attaching network resources."
|
|
@@ -29771,7 +29839,7 @@ var XcpngSnapshotVmResultSchema = z.object({
|
|
|
29771
29839
|
command: z.string().optional(),
|
|
29772
29840
|
error: z.string().optional()
|
|
29773
29841
|
});
|
|
29774
|
-
async function
|
|
29842
|
+
async function run236(context) {
|
|
29775
29843
|
const { params, error } = context;
|
|
29776
29844
|
const {
|
|
29777
29845
|
vm_uuid: vmUuidParam,
|
|
@@ -29841,7 +29909,7 @@ async function run240(context) {
|
|
|
29841
29909
|
command: snapshotResult.command
|
|
29842
29910
|
};
|
|
29843
29911
|
}
|
|
29844
|
-
var snapshot_vm_default = task(
|
|
29912
|
+
var snapshot_vm_default = task(run236, {
|
|
29845
29913
|
inputSchema: XcpngSnapshotVmParamsSchema,
|
|
29846
29914
|
outputSchema: XcpngSnapshotVmResultSchema,
|
|
29847
29915
|
description: "Creates a snapshot of an XCP-ng VM (optionally with quiesce)."
|
|
@@ -29868,7 +29936,7 @@ var XcpngImportVdiResultSchema = z.object({
|
|
|
29868
29936
|
appliedCommands: z.array(z.string()),
|
|
29869
29937
|
error: z.string().optional()
|
|
29870
29938
|
});
|
|
29871
|
-
async function
|
|
29939
|
+
async function run237(context) {
|
|
29872
29940
|
const { params, error } = context;
|
|
29873
29941
|
const {
|
|
29874
29942
|
sr_uuid: srUuidParam,
|
|
@@ -29990,7 +30058,7 @@ async function run241(context) {
|
|
|
29990
30058
|
appliedCommands
|
|
29991
30059
|
};
|
|
29992
30060
|
}
|
|
29993
|
-
var import_vdi_default = task(
|
|
30061
|
+
var import_vdi_default = task(run237, {
|
|
29994
30062
|
inputSchema: XcpngImportVdiParamsSchema,
|
|
29995
30063
|
outputSchema: XcpngImportVdiResultSchema,
|
|
29996
30064
|
description: "Imports a VDI file into a storage repository via xe vdi-import."
|
|
@@ -30092,7 +30160,7 @@ var XcpngVmMigrateResultSchema = z.object({
|
|
|
30092
30160
|
skipped: z.boolean().optional(),
|
|
30093
30161
|
error: z.string().optional()
|
|
30094
30162
|
});
|
|
30095
|
-
async function
|
|
30163
|
+
async function run238(context) {
|
|
30096
30164
|
const { params, error } = context;
|
|
30097
30165
|
const {
|
|
30098
30166
|
vm_uuid: vmUuidParam,
|
|
@@ -30216,7 +30284,7 @@ async function run242(context) {
|
|
|
30216
30284
|
appliedCommands
|
|
30217
30285
|
};
|
|
30218
30286
|
}
|
|
30219
|
-
var vm_migrate_default = task(
|
|
30287
|
+
var vm_migrate_default = task(run238, {
|
|
30220
30288
|
inputSchema: XcpngVmMigrateParamsSchema,
|
|
30221
30289
|
outputSchema: XcpngVmMigrateResultSchema,
|
|
30222
30290
|
description: "Migrates a VM to another host (and optionally storage repository) via xe vm-migrate."
|
|
@@ -30241,7 +30309,7 @@ var XcpngVmExportResultSchema = z.object({
|
|
|
30241
30309
|
skipped: z.boolean().optional(),
|
|
30242
30310
|
error: z.string().optional()
|
|
30243
30311
|
});
|
|
30244
|
-
async function
|
|
30312
|
+
async function run239(context) {
|
|
30245
30313
|
const { params, error } = context;
|
|
30246
30314
|
const {
|
|
30247
30315
|
vm_uuid: vmUuidParam,
|
|
@@ -30330,7 +30398,7 @@ async function run243(context) {
|
|
|
30330
30398
|
appliedCommands
|
|
30331
30399
|
};
|
|
30332
30400
|
}
|
|
30333
|
-
var vm_export_default = task(
|
|
30401
|
+
var vm_export_default = task(run239, {
|
|
30334
30402
|
inputSchema: XcpngVmExportParamsSchema,
|
|
30335
30403
|
outputSchema: XcpngVmExportResultSchema,
|
|
30336
30404
|
description: "Exports a VM to an XVA file via xe vm-export."
|
|
@@ -30352,7 +30420,7 @@ var XcpngVmImportResultSchema = z.object({
|
|
|
30352
30420
|
appliedCommands: z.array(z.string()),
|
|
30353
30421
|
error: z.string().optional()
|
|
30354
30422
|
});
|
|
30355
|
-
async function
|
|
30423
|
+
async function run240(context) {
|
|
30356
30424
|
const { params, error } = context;
|
|
30357
30425
|
const {
|
|
30358
30426
|
filename,
|
|
@@ -30421,7 +30489,7 @@ async function run244(context) {
|
|
|
30421
30489
|
appliedCommands
|
|
30422
30490
|
};
|
|
30423
30491
|
}
|
|
30424
|
-
var vm_import_default = task(
|
|
30492
|
+
var vm_import_default = task(run240, {
|
|
30425
30493
|
inputSchema: XcpngVmImportParamsSchema,
|
|
30426
30494
|
outputSchema: XcpngVmImportResultSchema,
|
|
30427
30495
|
description: "Imports a VM image from an XVA file via xe vm-import."
|
|
@@ -30448,7 +30516,7 @@ var XcpngVmCopyResultSchema = z.object({
|
|
|
30448
30516
|
skipped: z.boolean().optional(),
|
|
30449
30517
|
error: z.string().optional()
|
|
30450
30518
|
});
|
|
30451
|
-
async function
|
|
30519
|
+
async function run241(context) {
|
|
30452
30520
|
const { params, error } = context;
|
|
30453
30521
|
const {
|
|
30454
30522
|
vm_uuid: vmUuidParam,
|
|
@@ -30575,7 +30643,7 @@ async function run245(context) {
|
|
|
30575
30643
|
appliedCommands
|
|
30576
30644
|
};
|
|
30577
30645
|
}
|
|
30578
|
-
var vm_copy_default = task(
|
|
30646
|
+
var vm_copy_default = task(run241, {
|
|
30579
30647
|
inputSchema: XcpngVmCopyParamsSchema,
|
|
30580
30648
|
outputSchema: XcpngVmCopyResultSchema,
|
|
30581
30649
|
description: "Creates a full copy of a VM, optionally targeting a different SR."
|
|
@@ -30595,7 +30663,7 @@ var XcpngDetachCdMediaResultSchema = z.object({
|
|
|
30595
30663
|
error: z.string().optional(),
|
|
30596
30664
|
skipped: z.boolean().optional()
|
|
30597
30665
|
});
|
|
30598
|
-
async function
|
|
30666
|
+
async function run242(context) {
|
|
30599
30667
|
if (!context.host) {
|
|
30600
30668
|
return {
|
|
30601
30669
|
success: false,
|
|
@@ -30732,7 +30800,7 @@ function filterCdDisks(disks) {
|
|
|
30732
30800
|
}
|
|
30733
30801
|
return results;
|
|
30734
30802
|
}
|
|
30735
|
-
var detach_cd_media_default = task(
|
|
30803
|
+
var detach_cd_media_default = task(run242, {
|
|
30736
30804
|
inputSchema: XcpngDetachCdMediaParamsSchema,
|
|
30737
30805
|
outputSchema: XcpngDetachCdMediaResultSchema,
|
|
30738
30806
|
description: "Detaches CD/DVD virtual media from a VM by unplugging and destroying associated VBDs."
|
|
@@ -30755,7 +30823,7 @@ var XcpngCleanupConfigDriveResultSchema = z.object({
|
|
|
30755
30823
|
error: z.string().optional(),
|
|
30756
30824
|
skipped: z.boolean().optional()
|
|
30757
30825
|
});
|
|
30758
|
-
async function
|
|
30826
|
+
async function run243(context) {
|
|
30759
30827
|
if (!context.host) {
|
|
30760
30828
|
return {
|
|
30761
30829
|
success: false,
|
|
@@ -30955,7 +31023,7 @@ async function run247(context) {
|
|
|
30955
31023
|
steps
|
|
30956
31024
|
};
|
|
30957
31025
|
}
|
|
30958
|
-
var cleanup_config_drive_default = task(
|
|
31026
|
+
var cleanup_config_drive_default = task(run243, {
|
|
30959
31027
|
inputSchema: XcpngCleanupConfigDriveParamsSchema,
|
|
30960
31028
|
outputSchema: XcpngCleanupConfigDriveResultSchema,
|
|
30961
31029
|
description: "Detaches an attached config-drive ISO from a VM and removes the associated VDI once the guest is halted."
|
|
@@ -31094,7 +31162,7 @@ var YumAddRepositoryResultSchema = z.object({
|
|
|
31094
31162
|
error: z.string().optional()
|
|
31095
31163
|
})
|
|
31096
31164
|
);
|
|
31097
|
-
async function
|
|
31165
|
+
async function run244(context) {
|
|
31098
31166
|
const { params, exec, info, error } = context;
|
|
31099
31167
|
const { content, name, sudo = true } = params;
|
|
31100
31168
|
if (!content) {
|
|
@@ -31126,7 +31194,7 @@ EOF`;
|
|
|
31126
31194
|
return { success: false, error: errorMsg };
|
|
31127
31195
|
}
|
|
31128
31196
|
}
|
|
31129
|
-
var add_repository_default2 = task(
|
|
31197
|
+
var add_repository_default2 = task(run244, {
|
|
31130
31198
|
description: "Adds a YUM repository.",
|
|
31131
31199
|
inputSchema: YumAddRepositoryParamsSchema,
|
|
31132
31200
|
outputSchema: YumAddRepositoryResultSchema
|
|
@@ -31152,7 +31220,7 @@ var DownloadOutputSchema = z.object({
|
|
|
31152
31220
|
path: z.string().optional(),
|
|
31153
31221
|
error: z.string().optional()
|
|
31154
31222
|
});
|
|
31155
|
-
async function
|
|
31223
|
+
async function run245(context) {
|
|
31156
31224
|
const { params, info, error, exec } = context;
|
|
31157
31225
|
const { url, dest, mode, sudo = false } = params;
|
|
31158
31226
|
if (!url || !dest) {
|
|
@@ -31197,7 +31265,7 @@ async function run249(context) {
|
|
|
31197
31265
|
return { success: false, error: errorMsg };
|
|
31198
31266
|
}
|
|
31199
31267
|
}
|
|
31200
|
-
var download_default = task(
|
|
31268
|
+
var download_default = task(run245, {
|
|
31201
31269
|
description: "Downloads a file from a URL using curl or wget.",
|
|
31202
31270
|
inputSchema: DownloadInputSchema,
|
|
31203
31271
|
outputSchema: DownloadOutputSchema
|
|
@@ -31228,7 +31296,7 @@ var InterfacesOutputSchema = z.object({
|
|
|
31228
31296
|
error: z.string()
|
|
31229
31297
|
})
|
|
31230
31298
|
);
|
|
31231
|
-
async function
|
|
31299
|
+
async function run246(context) {
|
|
31232
31300
|
const { params, info, error, exec } = context;
|
|
31233
31301
|
const { sudo = false } = params;
|
|
31234
31302
|
try {
|
|
@@ -31320,7 +31388,7 @@ async function run250(context) {
|
|
|
31320
31388
|
return { success: false, error: errorMsg };
|
|
31321
31389
|
}
|
|
31322
31390
|
}
|
|
31323
|
-
var interfaces_default = task(
|
|
31391
|
+
var interfaces_default = task(run246, {
|
|
31324
31392
|
name: "interfaces",
|
|
31325
31393
|
description: "Lists network interfaces with their properties.",
|
|
31326
31394
|
inputSchema: InterfacesInputSchema,
|
|
@@ -31346,7 +31414,7 @@ var NftablesApplyOutputSchema = z.object({
|
|
|
31346
31414
|
error: z.string().optional()
|
|
31347
31415
|
})
|
|
31348
31416
|
);
|
|
31349
|
-
async function
|
|
31417
|
+
async function run247(context) {
|
|
31350
31418
|
const { params, exec, info } = context;
|
|
31351
31419
|
const { config } = params;
|
|
31352
31420
|
if (!config) {
|
|
@@ -31370,7 +31438,7 @@ async function run251(context) {
|
|
|
31370
31438
|
return { success: false, error };
|
|
31371
31439
|
}
|
|
31372
31440
|
}
|
|
31373
|
-
var apply_default = task(
|
|
31441
|
+
var apply_default = task(run247, {
|
|
31374
31442
|
description: "Applies an nftables configuration.",
|
|
31375
31443
|
inputSchema: NftablesApplyInputSchema,
|
|
31376
31444
|
outputSchema: NftablesApplyOutputSchema
|
|
@@ -31393,7 +31461,7 @@ var FirewalldDisableResultSchema = z.object({
|
|
|
31393
31461
|
success: z.boolean(),
|
|
31394
31462
|
error: z.string().optional()
|
|
31395
31463
|
});
|
|
31396
|
-
async function
|
|
31464
|
+
async function run248(context) {
|
|
31397
31465
|
const { run: runTask, debug, error, info } = context;
|
|
31398
31466
|
const statusResult = await runTask(status_default({ service: "firewalld", sudo: true }));
|
|
31399
31467
|
if (!statusResult.success && (statusResult.error?.includes("Could not find") || statusResult.error?.includes("not-found"))) {
|
|
@@ -31417,7 +31485,7 @@ async function run252(context) {
|
|
|
31417
31485
|
info("firewalld service disabled successfully.");
|
|
31418
31486
|
return { success: true };
|
|
31419
31487
|
}
|
|
31420
|
-
var disable_default3 = task(
|
|
31488
|
+
var disable_default3 = task(run248, {
|
|
31421
31489
|
description: "Disables and stops the firewalld service.",
|
|
31422
31490
|
inputSchema: FirewalldDisableInputSchema,
|
|
31423
31491
|
outputSchema: FirewalldDisableResultSchema
|
|
@@ -31791,7 +31859,164 @@ function registrySize(registry2) {
|
|
|
31791
31859
|
return registry2.tasks().length;
|
|
31792
31860
|
}
|
|
31793
31861
|
|
|
31862
|
+
// src/task-cache.ts
|
|
31863
|
+
var DEFAULT_CACHE_MODE = "use";
|
|
31864
|
+
var LOCAL_HOST_SCOPE_KEY = "host:local";
|
|
31865
|
+
function normalizeValue(value) {
|
|
31866
|
+
if (value === void 0) {
|
|
31867
|
+
return void 0;
|
|
31868
|
+
}
|
|
31869
|
+
if (value === null) {
|
|
31870
|
+
return null;
|
|
31871
|
+
}
|
|
31872
|
+
if (typeof value === "bigint") {
|
|
31873
|
+
return value.toString();
|
|
31874
|
+
}
|
|
31875
|
+
if (value instanceof Date) {
|
|
31876
|
+
return value.toISOString();
|
|
31877
|
+
}
|
|
31878
|
+
if (Array.isArray(value)) {
|
|
31879
|
+
return value.map((item) => {
|
|
31880
|
+
const normalized = normalizeValue(item);
|
|
31881
|
+
return normalized === void 0 ? null : normalized;
|
|
31882
|
+
});
|
|
31883
|
+
}
|
|
31884
|
+
if (typeof value === "object") {
|
|
31885
|
+
const obj = value;
|
|
31886
|
+
const sortedKeys = Object.keys(obj).sort();
|
|
31887
|
+
const result = {};
|
|
31888
|
+
for (const key of sortedKeys) {
|
|
31889
|
+
const normalized = normalizeValue(obj[key]);
|
|
31890
|
+
if (normalized !== void 0) {
|
|
31891
|
+
result[key] = normalized;
|
|
31892
|
+
}
|
|
31893
|
+
}
|
|
31894
|
+
return result;
|
|
31895
|
+
}
|
|
31896
|
+
return value;
|
|
31897
|
+
}
|
|
31898
|
+
function stableJson(value) {
|
|
31899
|
+
const normalized = normalizeValue(value);
|
|
31900
|
+
return JSON.stringify(normalized ?? null);
|
|
31901
|
+
}
|
|
31902
|
+
function normalizeCacheConfig(cache) {
|
|
31903
|
+
if (!cache) {
|
|
31904
|
+
return { enabled: false, mode: DEFAULT_CACHE_MODE };
|
|
31905
|
+
}
|
|
31906
|
+
if (cache === true) {
|
|
31907
|
+
return { enabled: true, mode: DEFAULT_CACHE_MODE };
|
|
31908
|
+
}
|
|
31909
|
+
if (typeof cache === "string") {
|
|
31910
|
+
return { enabled: true, scope: cache, mode: DEFAULT_CACHE_MODE };
|
|
31911
|
+
}
|
|
31912
|
+
return {
|
|
31913
|
+
enabled: true,
|
|
31914
|
+
scope: cache.scope,
|
|
31915
|
+
key: cache.key,
|
|
31916
|
+
ttlMs: cache.ttlMs,
|
|
31917
|
+
mode: cache.mode ?? DEFAULT_CACHE_MODE
|
|
31918
|
+
};
|
|
31919
|
+
}
|
|
31920
|
+
function buildTaskCacheKey(taskIdentity, params) {
|
|
31921
|
+
const taskName = taskIdentity?.task?.name;
|
|
31922
|
+
const modulePath = taskIdentity?.task?.taskModuleAbsolutePath;
|
|
31923
|
+
const identity2 = taskName ?? (modulePath ? Path.new(modulePath).absolute().toString() : "unknown-task");
|
|
31924
|
+
const paramsHash = sha256(stableJson(params ?? {}));
|
|
31925
|
+
return `${identity2}:${paramsHash}`;
|
|
31926
|
+
}
|
|
31927
|
+
function buildHostScopeKey(host, configRef) {
|
|
31928
|
+
if (!host) {
|
|
31929
|
+
return LOCAL_HOST_SCOPE_KEY;
|
|
31930
|
+
}
|
|
31931
|
+
const identity2 = {
|
|
31932
|
+
alias: host.alias ?? "",
|
|
31933
|
+
hostname: host.hostname ?? "",
|
|
31934
|
+
user: host.user ?? "",
|
|
31935
|
+
port: host.port ?? 22,
|
|
31936
|
+
config: configRef ?? ""
|
|
31937
|
+
};
|
|
31938
|
+
return `host:${sha256(stableJson(identity2))}`;
|
|
31939
|
+
}
|
|
31940
|
+
function buildInvocationScopeKey(rootInvocationId) {
|
|
31941
|
+
return `invocation:${rootInvocationId}`;
|
|
31942
|
+
}
|
|
31943
|
+
var TaskCacheStore = class {
|
|
31944
|
+
entries = /* @__PURE__ */ new Map();
|
|
31945
|
+
runId;
|
|
31946
|
+
constructor(runId) {
|
|
31947
|
+
this.runId = runId ?? crypto.randomUUID();
|
|
31948
|
+
}
|
|
31949
|
+
globalScopeKey() {
|
|
31950
|
+
return `global:${this.runId}`;
|
|
31951
|
+
}
|
|
31952
|
+
get(scopeKey, cacheKey2) {
|
|
31953
|
+
const scope = this.entries.get(scopeKey);
|
|
31954
|
+
if (!scope) {
|
|
31955
|
+
return void 0;
|
|
31956
|
+
}
|
|
31957
|
+
const entry = scope.get(cacheKey2);
|
|
31958
|
+
if (!entry) {
|
|
31959
|
+
return void 0;
|
|
31960
|
+
}
|
|
31961
|
+
if (entry.expiresAt > 0 && Date.now() > entry.expiresAt) {
|
|
31962
|
+
scope.delete(cacheKey2);
|
|
31963
|
+
if (scope.size === 0) {
|
|
31964
|
+
this.entries.delete(scopeKey);
|
|
31965
|
+
}
|
|
31966
|
+
return void 0;
|
|
31967
|
+
}
|
|
31968
|
+
return entry;
|
|
31969
|
+
}
|
|
31970
|
+
set(scopeKey, cacheKey2, value, ttlMs) {
|
|
31971
|
+
const scope = this.entries.get(scopeKey) ?? /* @__PURE__ */ new Map();
|
|
31972
|
+
const expiresAt = ttlMs && ttlMs > 0 ? Date.now() + ttlMs : 0;
|
|
31973
|
+
const entry = { value, expiresAt };
|
|
31974
|
+
scope.set(cacheKey2, entry);
|
|
31975
|
+
this.entries.set(scopeKey, scope);
|
|
31976
|
+
return entry;
|
|
31977
|
+
}
|
|
31978
|
+
delete(scopeKey, cacheKey2) {
|
|
31979
|
+
const scope = this.entries.get(scopeKey);
|
|
31980
|
+
if (!scope) {
|
|
31981
|
+
return;
|
|
31982
|
+
}
|
|
31983
|
+
scope.delete(cacheKey2);
|
|
31984
|
+
if (scope.size === 0) {
|
|
31985
|
+
this.entries.delete(scopeKey);
|
|
31986
|
+
}
|
|
31987
|
+
}
|
|
31988
|
+
async resolve(scopeKey, cacheKey2, compute, options = {}) {
|
|
31989
|
+
const mode = options.mode ?? DEFAULT_CACHE_MODE;
|
|
31990
|
+
if (mode === "bypass") {
|
|
31991
|
+
return await compute();
|
|
31992
|
+
}
|
|
31993
|
+
if (mode === "use") {
|
|
31994
|
+
const cached = this.get(scopeKey, cacheKey2);
|
|
31995
|
+
if (cached) {
|
|
31996
|
+
return await cached.value;
|
|
31997
|
+
}
|
|
31998
|
+
}
|
|
31999
|
+
const promise = Promise.resolve().then(compute);
|
|
32000
|
+
this.set(scopeKey, cacheKey2, promise, options.ttlMs);
|
|
32001
|
+
try {
|
|
32002
|
+
return await promise;
|
|
32003
|
+
} catch (error) {
|
|
32004
|
+
this.delete(scopeKey, cacheKey2);
|
|
32005
|
+
throw error;
|
|
32006
|
+
}
|
|
32007
|
+
}
|
|
32008
|
+
};
|
|
32009
|
+
|
|
31794
32010
|
// src/app.ts
|
|
32011
|
+
function normalizePrivateKey2(value) {
|
|
32012
|
+
if (!value.includes("\n") && value.includes("\\n")) {
|
|
32013
|
+
return value.replace(/\\n/g, "\n");
|
|
32014
|
+
}
|
|
32015
|
+
return value;
|
|
32016
|
+
}
|
|
32017
|
+
function looksLikePrivateKey2(value) {
|
|
32018
|
+
return /-----BEGIN [A-Z0-9 ]+PRIVATE KEY-----/.test(value);
|
|
32019
|
+
}
|
|
31795
32020
|
var TaskTree = class {
|
|
31796
32021
|
// private taskEventBus: Emittery<{ newTask: NewTaskEvent; taskComplete: TaskCompleteEvent }>;
|
|
31797
32022
|
listr;
|
|
@@ -31887,6 +32112,7 @@ var App3 = class _App {
|
|
|
31887
32112
|
outputStyle;
|
|
31888
32113
|
_tmpDir;
|
|
31889
32114
|
tmpFileRegistry;
|
|
32115
|
+
taskCache;
|
|
31890
32116
|
taskTree;
|
|
31891
32117
|
verbosity = Verbosity.ERROR;
|
|
31892
32118
|
passwordProvider;
|
|
@@ -31896,6 +32122,7 @@ var App3 = class _App {
|
|
|
31896
32122
|
this.taskTree = new TaskTree();
|
|
31897
32123
|
this.outputStyle = "plain";
|
|
31898
32124
|
this.tmpFileRegistry = new TmpFileRegistry(this.hostctlTmpDir());
|
|
32125
|
+
this.taskCache = new TaskCacheStore();
|
|
31899
32126
|
this.configRef = void 0;
|
|
31900
32127
|
this.hostSelector = void 0;
|
|
31901
32128
|
process3.on("exit", (code) => this.appExitCallback());
|
|
@@ -31910,8 +32137,8 @@ var App3 = class _App {
|
|
|
31910
32137
|
}
|
|
31911
32138
|
get tmpDir() {
|
|
31912
32139
|
if (!this._tmpDir) {
|
|
31913
|
-
if (!
|
|
31914
|
-
|
|
32140
|
+
if (!fs10.existsSync(this.hostctlDir().toString())) {
|
|
32141
|
+
fs10.mkdirSync(this.hostctlDir().toString(), { recursive: true });
|
|
31915
32142
|
}
|
|
31916
32143
|
this._tmpDir = this.createNamedTmpDir(version);
|
|
31917
32144
|
}
|
|
@@ -31925,10 +32152,11 @@ var App3 = class _App {
|
|
|
31925
32152
|
this.configProvider = provider;
|
|
31926
32153
|
if (provider instanceof FileConfigProvider) {
|
|
31927
32154
|
this.configRef = provider.path;
|
|
32155
|
+
this._config = await provider.getConfigFile();
|
|
31928
32156
|
} else {
|
|
31929
32157
|
this.configRef = "provider";
|
|
32158
|
+
this._config = await ProviderConfig.load(provider);
|
|
31930
32159
|
}
|
|
31931
|
-
this._config = await ProviderConfig.load(provider);
|
|
31932
32160
|
}
|
|
31933
32161
|
isValidUrl(url) {
|
|
31934
32162
|
try {
|
|
@@ -32132,9 +32360,28 @@ ${cmdRes.stderr.trim()}`));
|
|
|
32132
32360
|
host: host.hostname,
|
|
32133
32361
|
port: host.port,
|
|
32134
32362
|
username: host.user,
|
|
32135
|
-
password: hostPassword
|
|
32136
|
-
privateKeyPath: await host.plaintextSshKeyPath()
|
|
32363
|
+
password: hostPassword
|
|
32137
32364
|
};
|
|
32365
|
+
const sshKeyPassphrase = await host.decryptedSshKeyPassphrase();
|
|
32366
|
+
if (sshKeyPassphrase) {
|
|
32367
|
+
sshConnection.passphrase = sshKeyPassphrase;
|
|
32368
|
+
}
|
|
32369
|
+
const decryptedKey = await host.decryptedSshKey();
|
|
32370
|
+
if (decryptedKey) {
|
|
32371
|
+
const normalizedKey = normalizePrivateKey2(decryptedKey).trim();
|
|
32372
|
+
if (looksLikePrivateKey2(normalizedKey)) {
|
|
32373
|
+
sshConnection.privateKey = normalizedKey;
|
|
32374
|
+
} else if (fs10.existsSync(normalizedKey)) {
|
|
32375
|
+
sshConnection.privateKeyPath = normalizedKey;
|
|
32376
|
+
} else {
|
|
32377
|
+
sshConnection.privateKey = normalizedKey;
|
|
32378
|
+
}
|
|
32379
|
+
} else {
|
|
32380
|
+
const keyPath = await host.plaintextSshKeyPath();
|
|
32381
|
+
if (keyPath) {
|
|
32382
|
+
sshConnection.privateKeyPath = keyPath;
|
|
32383
|
+
}
|
|
32384
|
+
}
|
|
32138
32385
|
const interactionHandler = InteractionHandler.with(withSudo(hostPassword));
|
|
32139
32386
|
const session = new SSHSession();
|
|
32140
32387
|
await session.connect(sshConnection);
|
|
@@ -32211,6 +32458,27 @@ ${cmdRes.stderr.trim()}`));
|
|
|
32211
32458
|
}
|
|
32212
32459
|
taskContextForRunFn(invocation, params, hostForContext) {
|
|
32213
32460
|
const effectiveHost = hostForContext || invocation.host;
|
|
32461
|
+
const rootInvocationId = (() => {
|
|
32462
|
+
let current = invocation;
|
|
32463
|
+
while (current.parent) {
|
|
32464
|
+
current = current.parent;
|
|
32465
|
+
}
|
|
32466
|
+
return current.id;
|
|
32467
|
+
})();
|
|
32468
|
+
const defaultScope = () => effectiveHost ? "host" : "global";
|
|
32469
|
+
const scopeKeyFor = (scope) => {
|
|
32470
|
+
switch (scope) {
|
|
32471
|
+
case "global":
|
|
32472
|
+
return this.taskCache.globalScopeKey();
|
|
32473
|
+
case "host":
|
|
32474
|
+
return buildHostScopeKey(effectiveHost, this.configRef);
|
|
32475
|
+
case "invocation":
|
|
32476
|
+
return buildInvocationScopeKey(rootInvocationId);
|
|
32477
|
+
}
|
|
32478
|
+
};
|
|
32479
|
+
const isTaskFn = (candidate) => {
|
|
32480
|
+
return typeof candidate === "function" && !!candidate.task;
|
|
32481
|
+
};
|
|
32214
32482
|
return {
|
|
32215
32483
|
// Properties from TaskContext
|
|
32216
32484
|
params,
|
|
@@ -32240,8 +32508,58 @@ ${cmdRes.stderr.trim()}`));
|
|
|
32240
32508
|
ssh: async (tags, remoteTaskFn) => {
|
|
32241
32509
|
return await invocation.ssh(tags, remoteTaskFn);
|
|
32242
32510
|
},
|
|
32243
|
-
run: async (
|
|
32244
|
-
|
|
32511
|
+
run: async (...args) => {
|
|
32512
|
+
const [firstArg, secondArg, thirdArg] = args;
|
|
32513
|
+
let taskPartialFn;
|
|
32514
|
+
let taskIdentity;
|
|
32515
|
+
let paramsForKey;
|
|
32516
|
+
let options;
|
|
32517
|
+
if (isTaskFn(firstArg)) {
|
|
32518
|
+
taskIdentity = firstArg;
|
|
32519
|
+
paramsForKey = secondArg ?? {};
|
|
32520
|
+
options = thirdArg;
|
|
32521
|
+
taskPartialFn = taskIdentity(paramsForKey);
|
|
32522
|
+
} else {
|
|
32523
|
+
taskPartialFn = firstArg;
|
|
32524
|
+
options = secondArg;
|
|
32525
|
+
const meta = taskPartialFn;
|
|
32526
|
+
taskIdentity = meta.taskFn;
|
|
32527
|
+
paramsForKey = meta.params;
|
|
32528
|
+
}
|
|
32529
|
+
const cacheDecision = normalizeCacheConfig(options?.cache);
|
|
32530
|
+
if (!cacheDecision.enabled || cacheDecision.mode === "bypass") {
|
|
32531
|
+
return await invocation.run(taskPartialFn);
|
|
32532
|
+
}
|
|
32533
|
+
const scope = cacheDecision.scope ?? defaultScope();
|
|
32534
|
+
const cacheKey2 = cacheDecision.key ?? buildTaskCacheKey(taskIdentity, paramsForKey ?? {});
|
|
32535
|
+
const scopeKey = scopeKeyFor(scope);
|
|
32536
|
+
return await this.taskCache.resolve(scopeKey, cacheKey2, () => invocation.run(taskPartialFn), {
|
|
32537
|
+
ttlMs: cacheDecision.ttlMs,
|
|
32538
|
+
mode: cacheDecision.mode
|
|
32539
|
+
});
|
|
32540
|
+
},
|
|
32541
|
+
memoize: async (key, valueOrFactory, options) => {
|
|
32542
|
+
const cacheDecision = normalizeCacheConfig({
|
|
32543
|
+
scope: options?.scope,
|
|
32544
|
+
ttlMs: options?.ttlMs,
|
|
32545
|
+
mode: options?.mode,
|
|
32546
|
+
key
|
|
32547
|
+
});
|
|
32548
|
+
const scope = cacheDecision.scope ?? defaultScope();
|
|
32549
|
+
const scopeKey = scopeKeyFor(scope);
|
|
32550
|
+
const compute = async () => {
|
|
32551
|
+
if (typeof valueOrFactory === "function") {
|
|
32552
|
+
return await valueOrFactory();
|
|
32553
|
+
}
|
|
32554
|
+
return await valueOrFactory;
|
|
32555
|
+
};
|
|
32556
|
+
if (cacheDecision.mode === "bypass") {
|
|
32557
|
+
return await compute();
|
|
32558
|
+
}
|
|
32559
|
+
return await this.taskCache.resolve(scopeKey, key, compute, {
|
|
32560
|
+
ttlMs: cacheDecision.ttlMs,
|
|
32561
|
+
mode: cacheDecision.mode
|
|
32562
|
+
});
|
|
32245
32563
|
},
|
|
32246
32564
|
getPassword: async () => {
|
|
32247
32565
|
return await invocation.getPassword();
|
|
@@ -32473,7 +32791,7 @@ ${cmdRes.stderr.trim()}`));
|
|
|
32473
32791
|
await configFile.decryptAllIfPossible();
|
|
32474
32792
|
const successfullyUsedIdentityPaths = configFile.loadPrivateKeys().filter((identity2) => {
|
|
32475
32793
|
try {
|
|
32476
|
-
return
|
|
32794
|
+
return fs10.existsSync(identity2.identityFilePath);
|
|
32477
32795
|
} catch (e) {
|
|
32478
32796
|
return false;
|
|
32479
32797
|
}
|
|
@@ -32853,7 +33171,7 @@ ${successfullyUsedIdentityPaths}`);
|
|
|
32853
33171
|
};
|
|
32854
33172
|
|
|
32855
33173
|
// src/commands/pkg/create.ts
|
|
32856
|
-
import { promises as
|
|
33174
|
+
import { promises as fs11 } from "fs";
|
|
32857
33175
|
import os5 from "os";
|
|
32858
33176
|
import path11 from "path";
|
|
32859
33177
|
function expandTildePath(input) {
|
|
@@ -33080,22 +33398,22 @@ async function createPackage(packageName, options, output) {
|
|
|
33080
33398
|
const packageSlug = path11.basename(resolvedName);
|
|
33081
33399
|
const packageJsonName = packageName.startsWith("@") ? packageName : packageSlug;
|
|
33082
33400
|
const registryPrefix = registryPrefixFromPackageName(packageSlug);
|
|
33083
|
-
await
|
|
33401
|
+
await fs11.mkdir(packageDir, { recursive: true });
|
|
33084
33402
|
if (options.lang === "typescript") {
|
|
33085
|
-
await
|
|
33086
|
-
await
|
|
33087
|
-
await
|
|
33088
|
-
await
|
|
33089
|
-
await
|
|
33090
|
-
await
|
|
33091
|
-
await
|
|
33403
|
+
await fs11.writeFile(path11.join(packageDir, "package.json"), packageJsonTsTemplate(packageJsonName));
|
|
33404
|
+
await fs11.writeFile(path11.join(packageDir, "tsconfig.json"), tsconfigTemplate);
|
|
33405
|
+
await fs11.mkdir(path11.join(packageDir, "src", "tasks"), { recursive: true });
|
|
33406
|
+
await fs11.writeFile(path11.join(packageDir, "src", "index.ts"), indexTsTemplate(registryPrefix));
|
|
33407
|
+
await fs11.writeFile(path11.join(packageDir, "src", "tasks", "hello.ts"), sampleTaskTsTemplate);
|
|
33408
|
+
await fs11.writeFile(path11.join(packageDir, "README.md"), readmeTemplate(packageJsonName, registryPrefix, true));
|
|
33409
|
+
await fs11.writeFile(path11.join(packageDir, ".gitignore"), gitignoreTemplate);
|
|
33092
33410
|
} else {
|
|
33093
|
-
await
|
|
33094
|
-
await
|
|
33095
|
-
await
|
|
33096
|
-
await
|
|
33097
|
-
await
|
|
33098
|
-
await
|
|
33411
|
+
await fs11.writeFile(path11.join(packageDir, "package.json"), packageJsonJsTemplate(packageJsonName));
|
|
33412
|
+
await fs11.mkdir(path11.join(packageDir, "src", "tasks"), { recursive: true });
|
|
33413
|
+
await fs11.writeFile(path11.join(packageDir, "src", "index.js"), indexJsTemplate(registryPrefix));
|
|
33414
|
+
await fs11.writeFile(path11.join(packageDir, "src", "tasks", "hello.js"), sampleTaskJsTemplate);
|
|
33415
|
+
await fs11.writeFile(path11.join(packageDir, "README.md"), readmeTemplate(packageJsonName, registryPrefix, false));
|
|
33416
|
+
await fs11.writeFile(path11.join(packageDir, ".gitignore"), gitignoreTemplate);
|
|
33099
33417
|
}
|
|
33100
33418
|
const nextSteps = [];
|
|
33101
33419
|
nextSteps.push(`cd ${packageDir}`);
|
|
@@ -33231,14 +33549,14 @@ async function removePackage(packageIdentifier, app, output) {
|
|
|
33231
33549
|
import JSON5 from "json5";
|
|
33232
33550
|
|
|
33233
33551
|
// src/task-discovery.ts
|
|
33234
|
-
import { promises as
|
|
33552
|
+
import { promises as fs12 } from "fs";
|
|
33235
33553
|
import path12 from "path";
|
|
33236
33554
|
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
33237
33555
|
import { glob as glob3 } from "glob";
|
|
33238
33556
|
var metaCache = /* @__PURE__ */ new Map();
|
|
33239
33557
|
async function readPackageJson2(pkgPath) {
|
|
33240
33558
|
try {
|
|
33241
|
-
const pkgJson = await
|
|
33559
|
+
const pkgJson = await fs12.readFile(path12.join(pkgPath, "package.json"), "utf8");
|
|
33242
33560
|
const parsed = JSON.parse(pkgJson);
|
|
33243
33561
|
return { name: parsed.name, version: parsed.version };
|
|
33244
33562
|
} catch {
|