Skip to content

Commit

Permalink
Merge pull request #374 from facetofacebroadcasting/master
Browse files Browse the repository at this point in the history
added conf options to listNodes method of docker.js
  • Loading branch information
apocas authored May 23, 2017
2 parents f193e89 + af20118 commit acdfd45
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 acdfd45

Please sign in to comment.