From 4c27023aa541e67ada80b3197c0a024bf26306e7 Mon Sep 17 00:00:00 2001 From: knight42 Date: Sun, 12 Mar 2017 11:34:57 +0800 Subject: [PATCH] Fix inconsistent behaviour The modified methods are supposed to return a Promise if callback is undefined --- lib/container.js | 6 ------ lib/exec.js | 5 ----- lib/image.js | 5 ----- lib/network.js | 5 ----- lib/node.js | 10 ---------- lib/plugin.js | 5 ----- lib/secret.js | 5 ----- lib/service.js | 5 ----- lib/task.js | 5 ----- lib/volume.js | 5 ----- 10 files changed, 56 deletions(-) diff --git a/lib/container.js b/lib/container.js index 4404bb3..a75d936 100644 --- a/lib/container.js +++ b/lib/container.js @@ -45,12 +45,6 @@ Container.prototype.inspect = function(opts, callback) { var self = this; var args = util.processArgs(opts, callback); - if (typeof args.callback !== 'function') { - return JSON.stringify({ - id: this.id - }); - } - var optsf = { path: '/containers/' + this.id + '/json?', method: 'GET', diff --git a/lib/exec.js b/lib/exec.js index e413494..0bd9d4e 100644 --- a/lib/exec.js +++ b/lib/exec.js @@ -101,11 +101,6 @@ Exec.prototype.resize = function(opts, callback) { */ Exec.prototype.inspect = function(callback) { var self = this; - if (typeof callback !== 'function') { - return JSON.stringify({ - id: this.id - }); - } var optsf = { path: '/exec/' + this.id + '/json', diff --git a/lib/image.js b/lib/image.js index 6eee142..b7c5d99 100644 --- a/lib/image.js +++ b/lib/image.js @@ -17,11 +17,6 @@ var Image = function(modem, name) { */ Image.prototype.inspect = function(callback) { var self = this; - if (typeof callback !== 'function') { - return JSON.stringify({ - name: this.name - }); - } var opts = { path: '/images/' + this.name + '/json', diff --git a/lib/network.js b/lib/network.js index 4bd035b..8fa8fef 100644 --- a/lib/network.js +++ b/lib/network.js @@ -17,11 +17,6 @@ var Network = function(modem, id) { */ Network.prototype.inspect = function(callback) { var self = this; - if (typeof callback !== 'function') { - return JSON.stringify({ - Id: this.id - }); - } var opts = { path: '/networks/' + this.id, diff --git a/lib/node.js b/lib/node.js index af3170f..a50413f 100644 --- a/lib/node.js +++ b/lib/node.js @@ -18,11 +18,6 @@ var Node = function(modem, id) { */ Node.prototype.inspect = function(callback) { var self = this; - if (typeof callback !== 'function') { - return JSON.stringify({ - id: this.id - }); - } var optsf = { path: '/nodes/' + this.id, @@ -102,11 +97,6 @@ Node.prototype.update = function(opts, callback) { */ Node.prototype.remove = function(callback) { var self = this; - if (typeof callback !== 'function') { - return JSON.stringify({ - id: this.id - }); - } var optsf = { path: '/nodes/' + this.id, diff --git a/lib/plugin.js b/lib/plugin.js index debdbe1..c7b6a51 100644 --- a/lib/plugin.js +++ b/lib/plugin.js @@ -18,11 +18,6 @@ var Plugin = function(modem, name, remote) { */ Plugin.prototype.inspect = function(callback) { var self = this; - if (typeof callback !== 'function') { - return JSON.stringify({ - name: this.name - }); - } var optsf = { path: '/plugins/' + this.name, diff --git a/lib/secret.js b/lib/secret.js index 1c0a581..be30d05 100644 --- a/lib/secret.js +++ b/lib/secret.js @@ -17,11 +17,6 @@ var Secret = function(modem, id) { */ Secret.prototype.inspect = function(callback) { var self = this; - if (typeof callback !== 'function') { - return JSON.stringify({ - id: this.id - }); - } var optsf = { path: '/secrets/' + this.id, diff --git a/lib/service.js b/lib/service.js index 7335641..4432ae5 100644 --- a/lib/service.js +++ b/lib/service.js @@ -18,11 +18,6 @@ var Service = function(modem, id) { */ Service.prototype.inspect = function(callback) { var self = this; - if (typeof callback !== 'function') { - return JSON.stringify({ - id: this.id - }); - } var optsf = { path: '/services/' + this.id, diff --git a/lib/task.js b/lib/task.js index 437f222..32fe803 100644 --- a/lib/task.js +++ b/lib/task.js @@ -18,11 +18,6 @@ var Task = function(modem, id) { */ Task.prototype.inspect = function(callback) { var self = this; - if (typeof callback !== 'function') { - return JSON.stringify({ - id: this.id - }); - } var optsf = { path: '/tasks/' + this.id, diff --git a/lib/volume.js b/lib/volume.js index 233e7db..4a6dc28 100644 --- a/lib/volume.js +++ b/lib/volume.js @@ -17,11 +17,6 @@ var Volume = function(modem, name) { */ Volume.prototype.inspect = function(callback) { var self = this; - if (typeof callback !== 'function') { - return JSON.stringify({ - name: this.name - }); - } var optsf = { path: '/volumes/' + this.name,