@eliware/vyops 1.0.10 → 1.0.12
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/RELEASE_NOTES.md +15 -0
- package/package.json +1 -1
- package/src/deploy.mjs +10 -7
- package/src/ssh.mjs +3 -3
package/RELEASE_NOTES.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Release Notes
|
|
2
2
|
|
|
3
|
+
## 1.0.11
|
|
4
|
+
|
|
5
|
+
- Fix VyOS 1.5 `commit-confirm` handling by answering confirmation prompts
|
|
6
|
+
with the full `yes` response.
|
|
7
|
+
- Add real disposable-VyOS integration coverage for deployment, backup,
|
|
8
|
+
script synchronization, and invalid configuration handling.
|
|
9
|
+
- Allow WAN/VPN latency in opt-in real-router integration tests.
|
|
10
|
+
|
|
11
|
+
Verification:
|
|
12
|
+
|
|
13
|
+
- `npm test` (100% coverage across statements, branches, functions, and lines)
|
|
14
|
+
- Real VyOS integration suite (4 tests)
|
|
15
|
+
- `npm run lint`
|
|
16
|
+
- `npm run audit`
|
|
17
|
+
|
|
3
18
|
## 1.0.10
|
|
4
19
|
|
|
5
20
|
- Make Git integration optional for deployments using standalone config files.
|
package/package.json
CHANGED
package/src/deploy.mjs
CHANGED
|
@@ -67,19 +67,19 @@ async function installScripts(client, config, log, runId) {
|
|
|
67
67
|
await exec(client, `sudo rm -f -- ${names.map(name => JSON.stringify(`${installDir}/${name}`)).join(' ')}; sudo cp -a ${JSON.stringify(`${backupDir}/.`)} ${JSON.stringify(`${installDir}/`)} 2>/dev/null || true; rm -rf -- ${JSON.stringify(remoteDir)} ${JSON.stringify(backupDir)}`).catch(cleanupError => log(`script rollback failed: ${cleanupError.message}`));
|
|
68
68
|
throw error;
|
|
69
69
|
}
|
|
70
|
-
return async committed => {
|
|
70
|
+
return async (committed, activeClient) => {
|
|
71
71
|
if (committed) {
|
|
72
|
-
await exec(
|
|
72
|
+
await exec(activeClient, `sudo rm -rf -- ${JSON.stringify(backupDir)}; rm -rf -- ${JSON.stringify(remoteDir)}`).catch(error => log(`hook cleanup failed: ${error.message}`));
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
|
-
await exec(
|
|
75
|
+
await exec(activeClient, `sudo rm -f -- ${names.map(name => JSON.stringify(`${installDir}/${name}`)).join(' ')}; sudo cp -a ${JSON.stringify(`${backupDir}/.`)} ${JSON.stringify(`${installDir}/`)} 2>/dev/null || true; rm -rf -- ${JSON.stringify(remoteDir)} ${JSON.stringify(backupDir)}`).catch(error => log(`script rollback failed: ${error.message}`));
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
export async function deploy({ target, config, password }) {
|
|
80
80
|
const debugLog = message => log.debug(`[vyops] ${message}`);
|
|
81
81
|
debugLog(`connecting: ${target}`);
|
|
82
|
-
|
|
82
|
+
let client = password === undefined ? await connect(target) : await connect(target, { password });
|
|
83
83
|
debugLog('SSH connected');
|
|
84
84
|
let finalizeHooks;
|
|
85
85
|
let hooksFinalized = false;
|
|
@@ -91,6 +91,9 @@ export async function deploy({ target, config, password }) {
|
|
|
91
91
|
await upload(client, config, remote);
|
|
92
92
|
debugLog(`upload complete: ${remote}`);
|
|
93
93
|
finalizeHooks = await installScripts(client, config, debugLog, runId);
|
|
94
|
+
debugLog('reconnecting before interactive deployment sequence');
|
|
95
|
+
await close(client);
|
|
96
|
+
client = password === undefined ? await connect(target) : await connect(target, { password });
|
|
94
97
|
debugLog('starting interactive deployment sequence');
|
|
95
98
|
const output = await interactive(client, [
|
|
96
99
|
'configure',
|
|
@@ -99,7 +102,7 @@ export async function deploy({ target, config, password }) {
|
|
|
99
102
|
"printf '%s\\n' '--- compare ---'",
|
|
100
103
|
'compare',
|
|
101
104
|
"printf '%s\\n' '--- end compare ---'",
|
|
102
|
-
{ command: 'commit-confirm 5', reject: /(?:commit failed|commit aborted|cannot commit|configuration (?:commit )?failed|invalid configuration
|
|
105
|
+
{ command: 'commit-confirm 5', reject: /(?:commit failed|commit aborted|cannot commit|configuration (?:commit )?failed|invalid configuration)/i },
|
|
103
106
|
{ command: 'confirm', reject: /(?:confirm failed|error|invalid)/i },
|
|
104
107
|
{ command: 'save', reject: /(?:save failed|error|invalid)/i },
|
|
105
108
|
'exit',
|
|
@@ -113,11 +116,11 @@ export async function deploy({ target, config, password }) {
|
|
|
113
116
|
await download(client, '/config/config.boot', config);
|
|
114
117
|
if (finalizeHooks) {
|
|
115
118
|
hooksFinalized = true;
|
|
116
|
-
await finalizeHooks(true);
|
|
119
|
+
await finalizeHooks(true, client);
|
|
117
120
|
}
|
|
118
121
|
return 0;
|
|
119
122
|
} catch (error) {
|
|
120
|
-
if (finalizeHooks && !hooksFinalized && !deploymentCommitted) await finalizeHooks(false);
|
|
123
|
+
if (finalizeHooks && !hooksFinalized && !deploymentCommitted) await finalizeHooks(false, client);
|
|
121
124
|
throw error;
|
|
122
125
|
} finally {
|
|
123
126
|
debugLog('cleaning up remote file');
|
package/src/ssh.mjs
CHANGED
|
@@ -214,10 +214,10 @@ export function interactive(client, commands, log = () => {}) {
|
|
|
214
214
|
}
|
|
215
215
|
if (/Proceed\s*\?\s*\[Y\/n\]/i.test(cleaned) && !answering) {
|
|
216
216
|
answering = true;
|
|
217
|
-
log('commit-confirm prompt detected; sending:
|
|
217
|
+
log('commit-confirm prompt detected; sending: yes');
|
|
218
218
|
response = '';
|
|
219
|
-
stream.write('
|
|
220
|
-
log('write complete:
|
|
219
|
+
stream.write('yes\n');
|
|
220
|
+
log('write complete: yes');
|
|
221
221
|
return;
|
|
222
222
|
}
|
|
223
223
|
const commandComplete = waiting
|