stop TritonApi.listImages
passing internal options as query params to cloudapi
E.g.: `useCache` in the following: $ triton -v insts ... [2015-09-21T17:37:57.600Z] TRACE: triton/34623 on danger0.local (/Users/trentm/joy/node-triton/node_modules/restify-clients/lib/HttpClient.js:265 in rawRequest): request sent GET /trentm/images?useCache=true HTTP/1.1 Host: 10.88.88.6 date: Mon, 21 Sep 2015 17:37:57 GMT authorization: Signature keyId="/trentm/keys/de:e7:73:... accept: application/json user-agent: triton/1.0.0 (x64-darwin; node/0.10.40) accept-version: *
This commit is contained in:
parent
c93b08dd68
commit
94ebdb9f47
@ -171,7 +171,12 @@ TritonApi.prototype._cacheGetJson = function _cacheGetJson(key, cb) {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cloudapi listImages wrapper with optional caching
|
* CloudAPI listImages wrapper with optional caching.
|
||||||
|
*
|
||||||
|
* @param opts {Object} Optional.
|
||||||
|
* - useCase {Boolean} Whether to use Triton's local cache.
|
||||||
|
* - ... all other cloudapi ListImages options
|
||||||
|
* @param {Function} callback `function (err, imgs)`
|
||||||
*/
|
*/
|
||||||
TritonApi.prototype.listImages = function listImages(opts, cb) {
|
TritonApi.prototype.listImages = function listImages(opts, cb) {
|
||||||
var self = this;
|
var self = this;
|
||||||
@ -183,6 +188,9 @@ TritonApi.prototype.listImages = function listImages(opts, cb) {
|
|||||||
assert.optionalBool(opts.useCache, 'opts.useCache');
|
assert.optionalBool(opts.useCache, 'opts.useCache');
|
||||||
assert.func(cb, 'cb');
|
assert.func(cb, 'cb');
|
||||||
|
|
||||||
|
var listOpts = common.objCopy(opts);
|
||||||
|
delete listOpts.useCache;
|
||||||
|
|
||||||
var cacheKey = 'images.json';
|
var cacheKey = 'images.json';
|
||||||
var cached;
|
var cached;
|
||||||
var fetched;
|
var fetched;
|
||||||
@ -207,7 +215,7 @@ TritonApi.prototype.listImages = function listImages(opts, cb) {
|
|||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
|
|
||||||
self.cloudapi.listImages(opts, function (err, imgs, res_) {
|
self.cloudapi.listImages(listOpts, function (err, imgs, res_) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return next(err);
|
return next(err);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user