style nits, no functional change

This commit is contained in:
Trent Mick 2015-10-06 23:28:25 -07:00
parent 8ece8d0024
commit b73766d399

View File

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