filter image version on the server

This commit is contained in:
Dave Eddy 2015-09-21 17:16:47 -04:00
parent aaeb58730b
commit a6d9bad267

View File

@ -271,7 +271,11 @@ TritonApi.prototype.getImage = function getImage(name, cb) {
var s = name.split('@');
name = s[0];
var version = s[1];
this.cloudapi.listImages(function (err, imgs) {
var opts = {};
if (version)
opts.version = version;
this.cloudapi.listImages(opts, function (err, imgs) {
if (err) {
return cb(err);
}
@ -280,8 +284,6 @@ TritonApi.prototype.getImage = function getImage(name, cb) {
var shortIdMatches = [];
for (var i = 0; i < imgs.length; i++) {
var img = imgs[i];
if (version && img.version !== version)
continue;
if (img.name === name) {
nameMatches.push(img);
}