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);
|
next(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var _img = images.filter(function (i) {
|
for (var i = 0; i < images.length; i++) {
|
||||||
return i.id === opts.name;
|
if (images[i].id === opts.name) {
|
||||||
});
|
img = images[i];
|
||||||
if (_img.length === 1)
|
break;
|
||||||
img = _img[0];
|
}
|
||||||
|
}
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -291,8 +292,8 @@ TritonApi.prototype.getImage = function getImage(opts, cb) {
|
|||||||
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(
|
||||||
format('image with id %s was not found', name));
|
'image with id %s was not found', opts.name));
|
||||||
}
|
}
|
||||||
next(err);
|
next(err);
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user