ssh-client-wrapper 2.4.0 → 2.5.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.
package/lib/rsyncExec.js CHANGED
@@ -7,7 +7,7 @@ const { glob } = require("glob");
7
7
  const { connect, retryWrapper, sshExec } = require("./sshExec.js");
8
8
  const { fork } = require("./fork.js");
9
9
 
10
- const { sshCmd, rsyncCmd, getSshOption } = require("./util.js");
10
+ const { sshCmd, rsyncCmd, acceptableRsyncRetrunCodes, getSshOption } = require("./util.js");
11
11
 
12
12
  async function checkRsyncVersion (timeout) {
13
13
  const rt = {};
@@ -79,7 +79,7 @@ async function send (hostInfo, argSrc, dst, rsyncOpt, timeout) {
79
79
  }
80
80
  debug(`send ${src} to ${hostInfo.host}:${dst}`);
81
81
  debugVerbose(`send: ${rsyncCmd} ${args.join(" ")}`);
82
- return retryWrapper(fork.bind(null, hostInfo, rsyncCmd, args, timeout, null, [12]), hostInfo);
82
+ return retryWrapper(fork.bind(null, hostInfo, rsyncCmd, args, timeout, null, acceptableRsyncRetrunCodes), hostInfo);
83
83
  }
84
84
 
85
85
  /**
@@ -119,7 +119,7 @@ async function recv (hostInfo, argSrc, dst, rsyncOpt, timeout) {
119
119
 
120
120
  debug(`recv ${src} to ${dst}`);
121
121
  debugVerbose(`recv: ${rsyncCmd} ${args.join(" ")}`);
122
- return retryWrapper(fork.bind(null, hostInfo, rsyncCmd, args, timeout, null, [12]), hostInfo);
122
+ return retryWrapper(fork.bind(null, hostInfo, rsyncCmd, args, timeout, null, acceptableRsyncRetrunCodes), hostInfo);
123
123
  }
124
124
  module.exports = {
125
125
  checkRsyncVersion,
package/lib/sshExec.js CHANGED
@@ -260,10 +260,13 @@ async function retryWrapper (func, hostInfo, argMaxRetry, argDuration) {
260
260
  return rt;
261
261
  } catch (e) {
262
262
  if (!e.retryable) {
263
+ debug("unretryable error occurred!");
263
264
  throw e;
264
265
  }
265
266
  if (retryCount > maxRetry) {
266
267
  debug(`max retry count exceeded: ${retryCount}`);
268
+ e.retryCount = retryCount;
269
+ e.maxRetryCount = maxRetry;
267
270
  throw e;
268
271
  }
269
272
  retryCount++;
package/lib/util.js CHANGED
@@ -6,6 +6,7 @@ const { setTimeout: setTimeoutPromise } = require("timers/promises");
6
6
 
7
7
  const sshCmd = "ssh";
8
8
  const rsyncCmd = "rsync";
9
+ const acceptableRsyncRetrunCodes = [10, 11, 12, 13, 14];
9
10
 
10
11
  const rePwPrompt = /password:/;
11
12
  const rePhPrompt = /Enter passphrase for key/;
@@ -244,6 +245,7 @@ const watchDogTimer = (timeout, label, cb) => {
244
245
  module.exports = {
245
246
  sshCmd,
246
247
  rsyncCmd,
248
+ acceptableRsyncRetrunCodes,
247
249
  rePwPrompt,
248
250
  rePhPrompt,
249
251
  reNewHostPrompt,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ssh-client-wrapper",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "description": "wrapper library for open ssh client and rsync",
5
5
  "keywords": [
6
6
  "ssh",