ssh-client-wrapper 2.8.0 → 2.10.0

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.
@@ -1,4 +1,3 @@
1
- version: "3.8"
2
1
  services:
3
2
  testbed:
4
3
  image: naoso5/test-sshd
package/lib/index.js CHANGED
@@ -23,7 +23,7 @@ const { isArrayOfString, sanityCheck } = require("./util.js");
23
23
  * @param {string | Function} hostInfo.password - password or function which return password
24
24
  * @param {string | Function} hostInfo.passphrase - passphrase or function which return passphrase of private key
25
25
  * @param {string} hostInfo.keyFile - private key filename
26
- * @param {boolean} hostInfo.noStrictHostkeyChecking - bypass host key checking if true
26
+ * @param {boolean} hostInfo.noStrictHostKeyChecking - bypass host key checking if true
27
27
  * @param {Integer} hostInfo.ControlPersist=180 - how long keep master connection after last client connection has been closed (sec).
28
28
  * @param {Integer} hostInfo.ConnectTimeout=60 - timeout used when connectiong to ths SSH server
29
29
  * @param {Integer} hostInfo.maxRetry=3 - max number of retry
package/lib/rsyncExec.js CHANGED
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  const path = require("path");
3
+ const fs = require("fs/promises");
3
4
  const debug = require("debug")("sshClientWrapper:debug:rsyncExec");
4
5
  const debugVerbose = require("debug")("sshClientWrapper:verbose:rsyncExec");
5
6
  const { glob } = require("glob");
@@ -116,6 +117,7 @@ async function recv (hostInfo, argSrc, dst, rsyncOpt, timeout) {
116
117
  if (await isNewRsync(hostInfo)) {
117
118
  args.unshift("--old-args");
118
119
  }
120
+ await fs.mkdir(dst, { recursive: true });
119
121
 
120
122
  debug(`recv ${src} to ${dst}`);
121
123
  debugVerbose(`recv: ${rsyncCmd} ${args.join(" ")}`);
package/lib/util.js CHANGED
@@ -34,7 +34,7 @@ const hostInfoSchema = {
34
34
  user: { type: "string", pattern: "\\S+", transform: ["trim"] },
35
35
  port: { type: "number", minimum: 0, maximum: 65535 },
36
36
  keyFile: { type: "string", pattern: "\\S+", transform: ["trim"] },
37
- noStrictHostkeyChecking: { type: "boolean" },
37
+ noStrictHostKeyChecking: { type: "boolean" },
38
38
  ControlPersist: { type: "number", minimum: 0, default: 180 },
39
39
  ConnectTimeout: { type: "number", minimum: 0 },
40
40
  ControlPersistDir: { type: "string", pattern: "\\S+", transform: ["trim"] },
@@ -190,7 +190,7 @@ const getSshOption = (hostInfo, withoutDestination) => {
190
190
  }
191
191
  }
192
192
 
193
- if (hostInfo.noStrictHostkeyChecking) {
193
+ if (hostInfo.noStrictHostKeyChecking) {
194
194
  args.push("-oStrictHostKeyChecking=no");
195
195
  }
196
196
  const controlPersist = Number.isInteger(hostInfo.ControlPersist) && hostInfo.ControlPersist >= 0 ? hostInfo.ControlPersist : "180";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ssh-client-wrapper",
3
- "version": "2.8.0",
3
+ "version": "2.10.0",
4
4
  "description": "wrapper library for open ssh client and rsync",
5
5
  "keywords": [
6
6
  "ssh",
package/run_test_all.sh CHANGED
@@ -1,13 +1,13 @@
1
1
  #!/bin/bash
2
2
 
3
3
  function cleanup(){
4
- docker-compose rm --stop --force testbed
4
+ docker compose rm --stop --force testbed
5
5
  }
6
6
 
7
7
  trap cleanup EXIT
8
8
  set -e -o pipefail
9
9
 
10
- docker-compose up testbed -d
10
+ docker compose up testbed -d
11
11
  export TEST_HOST=localhost
12
12
  export TEST_USER=testuser
13
13
  export TEST_PW=passw0rd
@@ -17,11 +17,11 @@ ssh-keygen -R '[localhost]:4100'
17
17
  npm run test
18
18
  echo local test success
19
19
 
20
- docker-compose run --build --rm tester
20
+ docker compose run --build --rm tester
21
21
  echo test on latest ubuntu success
22
22
 
23
- docker-compose run --build --rm tester-bullseye
23
+ docker compose run --build --rm tester-bullseye
24
24
  echo test on bullseye success
25
25
 
26
- docker-compose run --build --rm tester-buster
26
+ docker compose run --build --rm tester-buster
27
27
  echo test on buster success
@@ -78,21 +78,21 @@ describe("test for sanityCheck", () => {
78
78
  it("should just change type if string value specified for boolean member", () => {
79
79
  expect(sanityCheck({
80
80
  host,
81
- noStrictHostkeyChecking: "true"
81
+ noStrictHostKeyChecking: "true"
82
82
  })).to.deep.equal({
83
83
  host,
84
84
  ...defaultValues,
85
- noStrictHostkeyChecking: true
85
+ noStrictHostKeyChecking: true
86
86
  });
87
87
  });
88
88
  it("should just change type if number value specified for boolean member", () => {
89
89
  expect(sanityCheck({
90
90
  host,
91
- noStrictHostkeyChecking: 0
91
+ noStrictHostKeyChecking: 0
92
92
  })).to.deep.equal({
93
93
  host,
94
94
  ...defaultValues,
95
- noStrictHostkeyChecking: false
95
+ noStrictHostKeyChecking: false
96
96
  });
97
97
  });
98
98
  it("shold keep addtional properties", () => {