Skip to content

Commit

Permalink
Merge remote-tracking branch 'apocas/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
闪光 committed May 31, 2017
2 parents c2f32af + acdfd45 commit 93be2dc
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions lib/docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -500,18 +500,24 @@ Docker.prototype.listServices = function(opts, callback) {
* Lists Nodes
* @param {Function} callback Callback
*/
Docker.prototype.listNodes = function(callback) {
Docker.prototype.listNodes = function(opts, callback) {
var self = this;
var args = util.processArgs(opts, callback);

var optsf = {
path: '/nodes',
path: '/nodes?',
method: 'GET',
options: args.opts,
statusCodes: {
200: true,
500: 'server error'
400: 'bad parameter',
404: 'no such node',
500: 'server error',
503: 'node is not part of a swarm',
}
};

if (callback === undefined) {
if (args.callback === undefined) {
return new this.modem.Promise(function(resolve, reject) {
self.modem.dial(optsf, function(err, data) {
if (err) {
Expand All @@ -522,7 +528,7 @@ Docker.prototype.listNodes = function(callback) {
});
} else {
this.modem.dial(optsf, function(err, data) {
callback(err, data);
args.callback(err, data);
});
}
};
Expand Down

0 comments on commit 93be2dc

Please sign in to comment.