fix 'name' var usage; style nit on for-loop usage for early out
This commit is contained in:
parent
b73766d399
commit
a71a1ddba3
@ -275,11 +275,12 @@ TritonApi.prototype.getImage = function getImage(opts, cb) {
|
||||
next(err);
|
||||
return;
|
||||
}
|
||||
var _img = images.filter(function (i) {
|
||||
return i.id === opts.name;
|
||||
});
|
||||
if (_img.length === 1)
|
||||
img = _img[0];
|
||||
for (var i = 0; i < images.length; i++) {
|
||||
if (images[i].id === opts.name) {
|
||||
img = images[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
next();
|
||||
});
|
||||
},
|
||||
@ -291,8 +292,8 @@ TritonApi.prototype.getImage = function getImage(opts, cb) {
|
||||
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));
|
||||
err = new errors.ResourceNotFoundError(err, format(
|
||||
'image with id %s was not found', opts.name));
|
||||
}
|
||||
next(err);
|
||||
});
|
||||
|
Reference in New Issue
Block a user