style nits, no functional change

This commit is contained in:
Trent Mick 2015-10-06 23:28:25 -07:00
parent 8ece8d0024
commit b73766d399
1 changed files with 16 additions and 18 deletions

View File

@ -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);
}