diff --git a/lib/tritonapi.js b/lib/tritonapi.js index 70a20b7..fea63d7 100644 --- a/lib/tritonapi.js +++ b/lib/tritonapi.js @@ -288,8 +288,8 @@ TritonApi.prototype.getImage = function getImage(opts, cb) { next(); return; } - self.cloudapi.getImage({id: opts.name}, function (err, _img) { - img = _img; + self.cloudapi.getImage({id: opts.name}, function (err, img_) { + img = img_; if (err && err.restCode === 'ResourceNotFound') { err = new errors.ResourceNotFoundError(err, format('image with id %s was not found', name)); @@ -297,30 +297,28 @@ TritonApi.prototype.getImage = function getImage(opts, cb) { next(err); }); } - - ]}, function done(err) { - if (err) { - cb(err); - } else if (img.state !== 'active') { - cb(new errors.TritonError( - format('image %s is not active', opts.name))); - } else { - cb(null, img); - } + ]}, function done(err) { + if (err) { + cb(err); + } else if (img.state !== 'active') { + cb(new errors.TritonError( + format('image %s is not active', opts.name))); + } else { + cb(null, img); } - ); + }); } else { var s = opts.name.split('@'); var name = s[0]; var version = s[1]; - var _opts = {}; + var listOpts = {}; if (version) { - _opts.name = name; - _opts.version = version; - _opts.useCache = opts.useCache; + listOpts.name = name; + listOpts.version = version; + listOpts.useCache = opts.useCache; } - this.cloudapi.listImages(_opts, function (err, imgs) { + this.cloudapi.listImages(listOpts, function (err, imgs) { if (err) { return cb(err); }