ramm 0.0.21 → 0.0.23
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/ramm.js +23 -2
- package/dist/types/base.d.ts +5 -2
- package/dist/types/podman.d.ts +5 -0
- package/dist/types/ramm.d.ts +1 -1
- package/package.json +1 -1
package/dist/ramm.js
CHANGED
|
@@ -62,6 +62,19 @@ var tee = async (read) => {
|
|
|
62
62
|
process.stdout.write(value);
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
|
+
var teeErr = async (read) => {
|
|
66
|
+
const reader = read.getReader();
|
|
67
|
+
let output = "";
|
|
68
|
+
while (true) {
|
|
69
|
+
const { value, done: doneReading } = await reader.read();
|
|
70
|
+
if (doneReading) {
|
|
71
|
+
return output;
|
|
72
|
+
}
|
|
73
|
+
const decoder = new TextDecoder("utf-8");
|
|
74
|
+
output += decoder.decode(value);
|
|
75
|
+
process.stderr.write(value);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
65
78
|
var readStreamToStr = async (read) => {
|
|
66
79
|
const reader = read.getReader();
|
|
67
80
|
let output = "";
|
|
@@ -79,11 +92,15 @@ var execCommand = async (command) => {
|
|
|
79
92
|
const result = spawn(["bash", "-c", command], {
|
|
80
93
|
stdin: "inherit",
|
|
81
94
|
stdout: "pipe",
|
|
82
|
-
stderr: "
|
|
95
|
+
stderr: "pipe"
|
|
83
96
|
});
|
|
84
|
-
const output = await
|
|
97
|
+
const [output, outputErr] = await Promise.all([
|
|
98
|
+
tee(result.stdout),
|
|
99
|
+
teeErr(result.stderr)
|
|
100
|
+
]);
|
|
85
101
|
await result.exited;
|
|
86
102
|
return {
|
|
103
|
+
outputErr,
|
|
87
104
|
output,
|
|
88
105
|
spawnResult: result
|
|
89
106
|
};
|
|
@@ -174,6 +191,9 @@ var getCreateCommand = async (name) => {
|
|
|
174
191
|
const podmanCreateCommand = await $2`podman inspect --format '{{.Config.CreateCommand}}' ${name}`.nothrow().quiet();
|
|
175
192
|
return podmanCreateCommand.text().slice(0, -1).slice(1, -1) || "";
|
|
176
193
|
};
|
|
194
|
+
var loginPodman = async (address, login, password) => {
|
|
195
|
+
return await execCommand(`echo "${password}" | podman login --username "${login}" --password-stdin ${address}`);
|
|
196
|
+
};
|
|
177
197
|
var runPodmanContainer = async (name, command) => {
|
|
178
198
|
if (await getCreateCommand(name) !== command) {
|
|
179
199
|
await $2`podman rm -f ${name}`;
|
|
@@ -419,6 +439,7 @@ export {
|
|
|
419
439
|
passVarsClient,
|
|
420
440
|
normalizePath,
|
|
421
441
|
normalizeFileContent,
|
|
442
|
+
loginPodman,
|
|
422
443
|
installSystemPackage,
|
|
423
444
|
installPodman,
|
|
424
445
|
installBun,
|
package/dist/types/base.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Context } from "./context.ts";
|
|
2
2
|
export declare const defaultContext: Context;
|
|
3
|
+
export declare const teeErr: (read: ReadableStream) => Promise<string>;
|
|
3
4
|
export declare const execCommand: (command: string) => Promise<{
|
|
5
|
+
outputErr: string;
|
|
4
6
|
output: string;
|
|
5
|
-
spawnResult: import("bun").Subprocess<"inherit", "pipe", "
|
|
7
|
+
spawnResult: import("bun").Subprocess<"inherit", "pipe", "pipe">;
|
|
6
8
|
}>;
|
|
7
9
|
export declare const execCommandSilent: (command: string) => Promise<{
|
|
8
10
|
output: string;
|
|
@@ -10,6 +12,7 @@ export declare const execCommandSilent: (command: string) => Promise<{
|
|
|
10
12
|
}>;
|
|
11
13
|
export declare const copyFilesBySsh: (from: string, to: string, context: Context) => Promise<void>;
|
|
12
14
|
export declare const execBySsh: (command: string, context: Context) => Promise<{
|
|
15
|
+
outputErr: string;
|
|
13
16
|
output: string;
|
|
14
|
-
spawnResult: import("bun").Subprocess<"inherit", "pipe", "
|
|
17
|
+
spawnResult: import("bun").Subprocess<"inherit", "pipe", "pipe">;
|
|
15
18
|
}>;
|
package/dist/types/podman.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { Context } from "./context.ts";
|
|
2
2
|
export declare const installPodman: () => Promise<void>;
|
|
3
3
|
export declare const getCreateCommand: (name: string) => Promise<string>;
|
|
4
|
+
export declare const loginPodman: (address: string, login: string, password: string) => Promise<{
|
|
5
|
+
outputErr: string;
|
|
6
|
+
output: string;
|
|
7
|
+
spawnResult: import("bun").Subprocess<"inherit", "pipe", "pipe">;
|
|
8
|
+
}>;
|
|
4
9
|
export declare const runPodmanContainer: (name: string, command: string) => Promise<void>;
|
|
5
10
|
export declare const runPodmanContainerService: (name: string, command: string, context?: Context) => Promise<void>;
|
|
6
11
|
export declare const addNftPodmanRule: () => Promise<void>;
|
package/dist/types/ramm.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { execBySsh, execCommand, copyFilesBySsh } from "./base.ts";
|
|
2
2
|
export { Context } from "./context.ts";
|
|
3
3
|
export { installBun } from "./init.ts";
|
|
4
|
-
export { installPodman, runPodmanContainer } from "./podman.ts";
|
|
4
|
+
export { installPodman, runPodmanContainer, loginPodman } from "./podman.ts";
|
|
5
5
|
export { runPodmanContainerService, addNftPodmanRule } from "./podman.ts";
|
|
6
6
|
export { restartSystemdService } from "./systemd.ts";
|
|
7
7
|
export { installSystemPackage } from "./packages.ts";
|
package/package.json
CHANGED