diff --git a/lib/do_wait_instance.js b/lib/do_wait_instance.js index 7cb63a4..be4a7c0 100644 --- a/lib/do_wait_instance.js +++ b/lib/do_wait_instance.js @@ -73,11 +73,12 @@ function do_wait_instance(subcmd, opts, args, cb) { } uuids.forEach(function (id) { - var opts = { + var waitOpts = { id: id, states: states }; - self.triton.cloudapi.waitForMachineStates(opts, function (err, body, res) { + self.triton.cloudapi.waitForMachineStates(waitOpts, + function (err, body, res) { if (err) { cb(err); return; @@ -122,7 +123,7 @@ do_wait_instance.options = [ helpArg: 'STATES', help: 'Instance states on which to wait. Default is "running,failed".' + 'Values can be comma-separated or multiple uses of the option.' - }, + } ]; module.exports = do_wait_instance; diff --git a/lib/triton.js b/lib/triton.js index 5d398b9..88ee33c 100644 --- a/lib/triton.js +++ b/lib/triton.js @@ -166,9 +166,9 @@ Triton.prototype.listImages = function listImages(opts, cb) { if (!err && self.cacheDir) { // cache the results var data = JSON.stringify(imgs); - fs.writeFile(cacheFile, data, {encoding: 'utf8'}, function (err) { - if (err) - self.log.info({err: err}, 'error caching images results'); + fs.writeFile(cacheFile, data, {encoding: 'utf8'}, function (err2) { + if (err2) + self.log.info({err: err2}, 'error caching images results'); done(); }); } else { @@ -364,15 +364,15 @@ Triton.prototype.getInstance = function getInstance(name, cb) { nextOnce(err); }); s.on('readable', function () { - var inst; - while ((inst = s.read()) !== null) { - if (inst.id.slice(0, shortId.length) === shortId) { + var candidate; + while ((candidate = s.read()) !== null) { + if (candidate.id.slice(0, shortId.length) === shortId) { if (match) { return nextOnce(new Error( 'instance short id "%s" is ambiguous', shortId)); } else { - match = inst; + match = candidate; } } }