joyent/node-triton#130 triton
image caching should include disabled images
Reviewed by: Cody Peter Mello <cody.mello@joyent.com> Approved by: Cody Peter Mello <cody.mello@joyent.com>
This commit is contained in:
parent
c7f7f86126
commit
21f2d29c86
@ -5,9 +5,10 @@ Known issues:
|
||||
- `triton ssh ...` disables ssh ControlMaster to avoid issue #52.
|
||||
|
||||
|
||||
## 4.13.1 (not yet released)
|
||||
## 4.14.0 (not yet released)
|
||||
|
||||
(nothing yet)
|
||||
- [#130] Include disabled images when using an image cache (e.g. for filling in
|
||||
image name and version details in `triton ls` output.
|
||||
|
||||
|
||||
## 4.13.0
|
||||
|
@ -56,8 +56,10 @@ function do_instances(subcmd, opts, args, cb) {
|
||||
|
||||
vasync.parallel({funcs: [
|
||||
function getTheImages(next) {
|
||||
tritonapi.listImages({useCache: true},
|
||||
function (err, _imgs) {
|
||||
tritonapi.listImages({
|
||||
useCache: true,
|
||||
state: 'all'
|
||||
}, function (err, _imgs) {
|
||||
if (err) {
|
||||
next(err);
|
||||
} else {
|
||||
|
@ -76,8 +76,10 @@ function do_list(subcmd, opts, args, callback) {
|
||||
|
||||
vasync.parallel({funcs: [
|
||||
function getTheImages(next) {
|
||||
self.top.tritonapi.listImages({useCache: true},
|
||||
function (err, _imgs) {
|
||||
self.top.tritonapi.listImages({
|
||||
state: 'all',
|
||||
useCache: true
|
||||
}, function (err, _imgs) {
|
||||
if (err) {
|
||||
if (err.statusCode === 403) {
|
||||
/*
|
||||
|
@ -282,8 +282,9 @@ TritonApi.prototype._cacheGetJson = function _cacheGetJson(key, cb) {
|
||||
*
|
||||
* @param opts {Object} Optional.
|
||||
* - useCache {Boolean} Default false. Whether to use Triton's local cache.
|
||||
* Note that the *current* implementation will only use the cache
|
||||
* when there are no filter options.
|
||||
* Currently the cache is only used and updated if the filters are
|
||||
* exactly `{state: "all"}`. IOW, the ListImages call that returns
|
||||
* all visible images.
|
||||
* - ... all other cloudapi ListImages options per
|
||||
* <https://apidocs.joyent.com/cloudapi/#ListImages>
|
||||
* @param {Function} callback `function (err, imgs)`
|
||||
@ -304,10 +305,10 @@ TritonApi.prototype.listImages = function listImages(opts, cb) {
|
||||
// For now at least, we only cache full results (no filtering).
|
||||
var useCache = Boolean(opts.useCache);
|
||||
var cacheKey;
|
||||
if (Object.keys(listOpts).length > 0) {
|
||||
useCache = false;
|
||||
} else {
|
||||
if (Object.keys(listOpts).length === 1 && listOpts.state === 'all') {
|
||||
cacheKey = 'images.json';
|
||||
} else {
|
||||
useCache = false;
|
||||
}
|
||||
var cached;
|
||||
var fetched;
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "triton",
|
||||
"description": "Joyent Triton CLI and client (https://www.joyent.com/triton)",
|
||||
"version": "4.13.1",
|
||||
"version": "4.14.0",
|
||||
"author": "Joyent (joyent.com)",
|
||||
"dependencies": {
|
||||
"assert-plus": "0.2.0",
|
||||
|
Reference in New Issue
Block a user