From a6d9bad2676ce00a57bc8b0263f4283c9597e15d Mon Sep 17 00:00:00 2001 From: Dave Eddy Date: Mon, 21 Sep 2015 17:16:47 -0400 Subject: [PATCH] filter image version on the server --- lib/tritonapi.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/tritonapi.js b/lib/tritonapi.js index a68d2d4..e5493d6 100644 --- a/lib/tritonapi.js +++ b/lib/tritonapi.js @@ -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); }