Comparing version 2.4.3 to 2.5.0
@@ -503,14 +503,20 @@ var EventEmitter = require('events').EventEmitter, | ||
*/ | ||
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) { | ||
@@ -526,3 +532,3 @@ self.modem.dial(optsf, function(err, data) { | ||
this.modem.dial(optsf, function(err, data) { | ||
callback(err, data); | ||
args.callback(err, data); | ||
}); | ||
@@ -529,0 +535,0 @@ } |
@@ -100,7 +100,8 @@ var util = require('./util'); | ||
*/ | ||
Node.prototype.remove = function(callback) { | ||
Node.prototype.remove = function(opts, callback) { | ||
var self = this; | ||
var args = util.processArgs(opts, callback); | ||
var optsf = { | ||
path: '/nodes/' + this.id, | ||
path: '/nodes/' + this.id + '?', | ||
method: 'DELETE', | ||
@@ -111,6 +112,7 @@ statusCodes: { | ||
500: 'server error' | ||
} | ||
}, | ||
options: args.opts | ||
}; | ||
if(callback === undefined) { | ||
if(args.callback === undefined) { | ||
return new this.modem.Promise(function(resolve, reject) { | ||
@@ -126,3 +128,3 @@ self.modem.dial(optsf, function(err, data) { | ||
this.modem.dial(optsf, function(err, data) { | ||
callback(err, data); | ||
args.callback(err, data); | ||
}); | ||
@@ -129,0 +131,0 @@ } |
@@ -91,6 +91,12 @@ var util = require('./util'); | ||
var self = this; | ||
if (!callback && typeof opts === 'function') { | ||
callback = opts; | ||
opts = auth; | ||
auth = opts.authconfig || undefined; | ||
if (!callback) { | ||
var t = typeof opts; | ||
if(t === 'function'){ | ||
callback = opts; | ||
opts = auth; | ||
auth = opts.authconfig || undefined; | ||
} else if (t === 'undefined'){ | ||
opts = auth; | ||
auth = opts.authconfig || undefined; | ||
} | ||
} | ||
@@ -128,2 +134,43 @@ | ||
/** | ||
* Service logs | ||
* @param {Object} opts Logs options. (optional) | ||
* @param {Function} callback Callback with data | ||
*/ | ||
Service.prototype.logs = function(opts, callback) { | ||
var self = this; | ||
var args = util.processArgs(opts, callback, {}); | ||
var optsf = { | ||
path: '/services/' + this.id + '/logs?', | ||
method: 'GET', | ||
isStream: true, | ||
statusCodes: { | ||
200: true, | ||
404: 'no such service', | ||
500: 'server error', | ||
503: 'node is not part of a swarm' | ||
}, | ||
options: args.opts | ||
}; | ||
if(args.callback === undefined) { | ||
return new this.modem.Promise(function(resolve, reject) { | ||
self.modem.dial(optsf, function(err, data) { | ||
if (err) { | ||
return reject(err); | ||
} | ||
resolve(data); | ||
}); | ||
}); | ||
} else { | ||
this.modem.dial(optsf, function(err, data) { | ||
args.callback(err, data); | ||
}); | ||
} | ||
}; | ||
module.exports = Service; |
{ | ||
"name": "dockerode", | ||
"description": "Docker Remote API module.", | ||
"version": "2.4.3", | ||
"version": "2.5.0", | ||
"author": "Pedro Dias <petermdias@gmail.com>", | ||
@@ -19,3 +19,3 @@ "maintainers": [ | ||
"concat-stream": "~1.5.1", | ||
"docker-modem": "0.3.x", | ||
"docker-modem": "^1.0.0", | ||
"tar-fs": "~1.12.0" | ||
@@ -22,0 +22,0 @@ }, |
Sorry, the diff of this file is not supported yet
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
154529
3692
+ AddedJSONStream@1.3.2(transitive)
+ Addeddebug@3.2.7(transitive)
+ Addeddocker-modem@1.0.9(transitive)
+ Addedjsonparse@1.3.1(transitive)
+ Addedms@2.1.3(transitive)
- RemovedJSONStream@0.10.0(transitive)
- Removeddebug@2.6.9(transitive)
- Removeddocker-modem@0.3.7(transitive)
- Removedjsonparse@0.0.5(transitive)
- Removedms@2.0.0(transitive)
Updateddocker-modem@^1.0.0