@eliware/vyops 1.0.12 → 1.0.13

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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # Release Notes
2
2
 
3
+ ## Unreleased
4
+
5
+ - Close SFTP channels after uploads and downloads to prevent SSH channel exhaustion during script synchronization.
6
+ - Reconnect after interactive deployments before downloading live configuration and cleaning up remote files.
7
+ - Make Git path handling and the `test:gaps` coverage command portable across Windows and Linux.
8
+ - Expand Windows and real-VyOS integration coverage to maintain 100% statements, branches, functions, and lines coverage.
9
+
3
10
  ## 1.0.11
4
11
 
5
12
  - Fix VyOS 1.5 `commit-confirm` handling by answering confirmation prompts
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@eliware/vyops",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "Deploy native VyOS configuration files over SSH.",
5
5
  "main": "vyops.mjs",
6
6
  "scripts": {
7
7
  "lint": "npx oxlint .",
8
8
  "test": "npx --node-options=\"--experimental-vm-modules --no-warnings\" jest --detectOpenHandles --silent --coverage",
9
9
  "deploy": "./vyops.mjs",
10
- "test:gaps": "npm test 2>&1 | grep '|' | grep -vF '| 100 | 100 | 100 | 100 |'",
10
+ "test:gaps": "node scripts/test-gaps.mjs",
11
11
  "pack": "npm pack --dry-run",
12
12
  "validate:package": "npm pack --dry-run --json | node scripts/validate-package.mjs",
13
- "audit": "npm audit --omit=dev --audit-level=moderate"
13
+ "audit": "node scripts/audit.mjs"
14
14
  },
15
15
  "keywords": [
16
16
  "vyos",
package/src/deploy.mjs CHANGED
@@ -112,6 +112,9 @@ export async function deploy({ target, config, password }) {
112
112
  deploymentCommitted = true;
113
113
  const compare = extractCompare(output);
114
114
  if (compare) log.info(compare);
115
+ debugLog('reconnecting after interactive deployment sequence');
116
+ await close(client);
117
+ client = password === undefined ? await connect(target) : await connect(target, { password });
115
118
  debugLog(`syncing live config: /config/config.boot -> ${config}`);
116
119
  await download(client, '/config/config.boot', config);
117
120
  if (finalizeHooks) {
package/src/git.mjs CHANGED
@@ -72,7 +72,7 @@ async function repositoryRoot(config) {
72
72
  export async function shouldSkip(config) {
73
73
  const repo = await repositoryRoot(config);
74
74
  if (!repo) return false;
75
- const relative = config.startsWith(`${repo}/`) ? config.slice(repo.length + 1) : config;
75
+ const relative = config.startsWith(repo) ? config.slice(repo.length).replace(/^[/\\]/, '') : config;
76
76
  const { stdout: status } = await git(['status', '--porcelain', '--', relative], repo);
77
77
  if (status.trim()) return false;
78
78
  const { stdout: subject } = await git(['log', '-1', '--format=%s'], repo);
@@ -83,7 +83,7 @@ export async function pushBack(config, { force = false } = {}) {
83
83
  const repo = await repositoryRoot(config);
84
84
  if (!repo) return false;
85
85
  return withRepositoryLock(repo, async () => {
86
- const relative = config.startsWith(`${repo}/`) ? config.slice(repo.length + 1) : config;
86
+ const relative = config.startsWith(repo) ? config.slice(repo.length).replace(/^[/\\]/, '') : config;
87
87
  const { stdout: diff } = await git(['diff', 'HEAD', '--', relative], repo);
88
88
  if (!diff) return false;
89
89
  await git(['add', '--', relative], repo);
package/src/ssh.mjs CHANGED
@@ -122,6 +122,7 @@ export async function upload(client, local, remote, mode = 0o600) {
122
122
  if (error) { clearTimeout(timer); return reject(error); }
123
123
  sftp.writeFile(remote, data, { mode }, error2 => {
124
124
  clearTimeout(timer);
125
+ sftp.end?.();
125
126
  return error2 ? reject(error2) : resolve();
126
127
  });
127
128
  });
@@ -136,6 +137,7 @@ export function download(client, remote, local) {
136
137
  if (error) { clearTimeout(timer); return reject(error); }
137
138
  sftp.fastGet(remote, local, error2 => {
138
139
  clearTimeout(timer);
140
+ sftp.end?.();
139
141
  return error2 ? reject(error2) : resolve();
140
142
  });
141
143
  });