-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #225 from DinoChiesa/issue197a
enable updateTargetServer command
- Loading branch information
Showing
16 changed files
with
256 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
engine-strict=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,33 @@ | ||
var defaults = require('../defaults') | ||
var request = require('request') | ||
var util = require('util') | ||
const defaults = require('../defaults'), | ||
util = require('util'); | ||
|
||
module.exports.run = function(command, opts, requestOpts,done){ | ||
if (opts.verbose) { | ||
console.log('running command ' + command) | ||
} | ||
var request = defaults.defaultRequest(opts); | ||
request(requestOpts,function(err,res,body){ | ||
var jsonBody = body | ||
if(err){ | ||
done(err) | ||
}else if (res.statusCode == 200 || res.statusCode == 201 || res.statusCode == 204) { | ||
if (opts.verbose) { | ||
console.log(command + ' successful'); | ||
} | ||
if (opts.debug) { | ||
console.log('%s', body); | ||
} | ||
done(undefined, jsonBody); | ||
}else { | ||
if (opts.verbose) { | ||
console.error(command + ' result: %j', body); | ||
} | ||
var errMsg; | ||
if (jsonBody && (jsonBody.message)) { | ||
errMsg = jsonBody.message; | ||
} else { | ||
errMsg = util.format(command + ' failed with status code %d', res.statusCode); | ||
} | ||
done(new Error(errMsg)); | ||
} | ||
}) | ||
} | ||
module.exports.run = function(command, opts, requestOpts, done) { | ||
if (opts.verbose) { | ||
console.log(`${command} - ${requestOpts.method} ${requestOpts.uri}`); | ||
} | ||
var request = defaults.defaultRequest(opts); | ||
request(requestOpts, function(err, res, jsonBody) { | ||
if(err){ | ||
done(err); | ||
return; | ||
} | ||
if (res.statusCode == 200 || res.statusCode == 201 || res.statusCode == 204) { | ||
if (opts.verbose) { | ||
console.log(`${command} - success`); | ||
} | ||
if (opts.debug) { | ||
console.log('%s', jsonBody); | ||
} | ||
done(undefined, jsonBody); | ||
return; | ||
} | ||
if (opts.verbose) { | ||
console.error(command + ' result: %j', jsonBody); | ||
} | ||
let errMsg = (jsonBody && (jsonBody.message)) ? | ||
jsonBody.message : | ||
util.format(command + ' failed with status code %d', res.statusCode); | ||
|
||
done(new Error(errMsg)); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
lib/commands/listdeployments.js → lib/commands/listDeployments.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.