hany-consul-backup-restore
Advanced tools
Comparing version 1.2.3 to 1.2.4
{ | ||
"name": "hany-consul-backup-restore", | ||
"version": "1.2.3", | ||
"version": "1.2.4", | ||
"description": "Library to backup and restore consul key values", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -23,4 +23,4 @@ const parseUtil = require('./parseUtil') | ||
if (err) { | ||
callback(err) | ||
return null | ||
return callback(err) | ||
} | ||
@@ -30,12 +30,12 @@ }) | ||
if (err) { | ||
callback(err) | ||
return null | ||
return callback(err) | ||
} | ||
s3FileUtil.backup(keyValues, options.prefix, options.s3BucketName, options.filePath, (err, result) => { | ||
if (err) { | ||
callback(err) | ||
return | ||
return callback(err) | ||
} | ||
callback(null, result); | ||
return; | ||
return callback(null, result); | ||
}) | ||
@@ -47,3 +47,3 @@ }) | ||
options = parseUtil.parseOptions('restore', options, (err) => { | ||
if (err) return callback(err) | ||
if (err) return callback(err) | ||
}) | ||
@@ -54,13 +54,12 @@ | ||
s3.getObject({Bucket: options.s3BucketName, Key: options.filePath}, (err, data) => { | ||
if (err) return callback(err) | ||
if (err) return callback(err) | ||
else { | ||
consulUtil.restoreKeyValues(this.consulInstance, data.Body, options.override, (err, result) => { | ||
if (err) { | ||
callback(err) | ||
return; | ||
return callback(err) | ||
} | ||
if (result) { | ||
var blanksRemoved = result.filter(function (e) { return e }) | ||
callback(null, blanksRemoved) | ||
return | ||
return callback(null, blanksRemoved) | ||
} | ||
@@ -76,9 +75,9 @@ }) | ||
if (err) { | ||
callback(err); | ||
return; | ||
return callback(err); | ||
} | ||
if (result) { | ||
var blanksRemoved = result.filter(function (e) { return e }) | ||
callback(null, blanksRemoved) | ||
return; | ||
return callback(null, blanksRemoved) | ||
} | ||
@@ -85,0 +84,0 @@ }) |
@@ -13,3 +13,3 @@ const async = require('async') | ||
} | ||
callback(null, keyValues) | ||
return callback(null, keyValues) | ||
}) | ||
@@ -23,3 +23,3 @@ }) | ||
} | ||
callback(null, keyValue) | ||
return callback(null, keyValue) | ||
}) | ||
@@ -33,4 +33,4 @@ } | ||
async.map(keyValues, setConsulAndCheckOverride.bind(override), (err, keys) => { | ||
if (err) { callback(err) } | ||
callback(null, keys) | ||
if (err) { return callback(err) } | ||
return callback(null, keys) | ||
}) | ||
@@ -45,4 +45,4 @@ | ||
.then((willSetKey) => setConsulKeyValue(willSetKey, key, backupValue)) | ||
.then((restoredKey) => callback(null, `${restoredKey}`)) | ||
.catch((e) => callback(e)) | ||
.then((restoredKey) => return callback(null, `${restoredKey}`)) | ||
.catch((e) => return callback(e)) | ||
} | ||
@@ -53,8 +53,8 @@ | ||
consulInstance.kv.get(key, (err, result) => { | ||
if (err) reject(err) | ||
if (err) return reject(err) | ||
if (result) { | ||
resolve(JSON.stringify(result.Value)) | ||
return resolve(JSON.stringify(result.Value)) | ||
} else { | ||
resolve(null) | ||
return resolve(null) | ||
} | ||
@@ -71,8 +71,8 @@ }) | ||
if (overrideFlag) { | ||
resolve(true) | ||
return resolve(true) | ||
} else { | ||
resolve(false) | ||
return resolve(false) | ||
} | ||
} else { | ||
resolve(true) | ||
return resolve(true) | ||
} | ||
@@ -86,7 +86,7 @@ }) | ||
consulInstance.kv.set(key, backupValue, (err, result) => { | ||
if (err) reject(err) | ||
if (result) resolve(key) | ||
if (err) return reject(err) | ||
if (result) return resolve(key) | ||
}) | ||
} else { | ||
reject() | ||
return reject() | ||
} | ||
@@ -93,0 +93,0 @@ }) |
@@ -19,3 +19,3 @@ function createFileName (prefix) { | ||
incorrectUsageString += `Usage: cbr.${functionCall}({filePath:\'filePath\', s3BucketName:\'s3BucketName\'}` | ||
callback(Error(incorrectUsageString)) | ||
return callback(Error(incorrectUsageString)) | ||
} | ||
@@ -22,0 +22,0 @@ } |
@@ -7,5 +7,5 @@ const AWS = require('aws-sdk') | ||
fs.writeFile(backupFileName, writeData, (err) => { | ||
if (err) callback(err) | ||
if (err) return callback(err) | ||
callback(null, `${backupFileName}`) | ||
return callback(null, `${backupFileName}`) | ||
}) | ||
@@ -18,3 +18,3 @@ } | ||
.on('httpUploadProgress', function (evt) { console.log(evt) }) | ||
.send(function (err, writeData) { callback(err, writeData) }) | ||
.send(function (err, writeData) { return callback(err, writeData) }) | ||
} | ||
@@ -25,3 +25,3 @@ | ||
if (err) { | ||
callback(err) | ||
return callback(err) | ||
} | ||
@@ -32,5 +32,5 @@ }) | ||
if (err) { | ||
callback(err) | ||
return callback(err) | ||
} | ||
callback(null, result) | ||
return callback(null, result) | ||
}) | ||
@@ -40,7 +40,7 @@ } else { | ||
if (err) { | ||
callback(err) | ||
return callback(err) | ||
} | ||
callback(null, result) | ||
return callback(null, result) | ||
}) | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41842
444