'make check' clean
This commit is contained in:
parent
db81ff9db2
commit
018c46ef43
@ -181,7 +181,7 @@ CloudAPI.prototype._qs = function _qs(/* fields1, ...*/) {
|
|||||||
* Optionally an object of query params can be passed in to include a query
|
* Optionally an object of query params can be passed in to include a query
|
||||||
* string. This just calls `this._qs(...)`.
|
* string. This just calls `this._qs(...)`.
|
||||||
*/
|
*/
|
||||||
CloudAPI.prototype._path = function _path(subpath /*, qparams, ... */) {
|
CloudAPI.prototype._path = function _path(subpath /* , qparams, ... */) {
|
||||||
assert.string(subpath, 'subpath');
|
assert.string(subpath, 'subpath');
|
||||||
assert.ok(subpath[0] === '/');
|
assert.ok(subpath[0] === '/');
|
||||||
|
|
||||||
@ -301,7 +301,8 @@ CloudAPI.prototype.listServices = function listServices(opts, cb) {
|
|||||||
/**
|
/**
|
||||||
* Get datacenters information
|
* Get datacenters information
|
||||||
*
|
*
|
||||||
* @param {Function} callback of the form `function (err, datacenters, response)`
|
* @param {Function} callback of the form
|
||||||
|
* `function (err, datacenters, response)`
|
||||||
*/
|
*/
|
||||||
CloudAPI.prototype.listDatacenters = function listDatacenters(opts, cb) {
|
CloudAPI.prototype.listDatacenters = function listDatacenters(opts, cb) {
|
||||||
var endpoint = sprintf('/%s/datacenters', this.user);
|
var endpoint = sprintf('/%s/datacenters', this.user);
|
||||||
@ -492,7 +493,8 @@ CloudAPI.prototype._doMachine = function _doMachine(action, uuid, callback) {
|
|||||||
* - {Number} interval (optional) - time in ms to poll
|
* - {Number} interval (optional) - time in ms to poll
|
||||||
* @param {Function} callback - called when state is reached or on error
|
* @param {Function} callback - called when state is reached or on error
|
||||||
*/
|
*/
|
||||||
CloudAPI.prototype.waitForMachineStates = function waitForMachineStates(opts, callback) {
|
CloudAPI.prototype.waitForMachineStates =
|
||||||
|
function waitForMachineStates(opts, callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
assert.object(opts, 'opts');
|
assert.object(opts, 'opts');
|
||||||
assert.string(opts.id, 'opts.id');
|
assert.string(opts.id, 'opts.id');
|
||||||
@ -618,7 +620,7 @@ CloudAPI.prototype.machineAudit = function machineAudit(options, callback) {
|
|||||||
assert.func(callback, 'callback');
|
assert.func(callback, 'callback');
|
||||||
|
|
||||||
var path = sprintf('/%s/machines/%s/audit', self.user, options.id);
|
var path = sprintf('/%s/machines/%s/audit', self.user, options.id);
|
||||||
//XXX This `client.get` block is duplicated. Add a convenience function for it:
|
// XXX This `client.get` block is duplicated. Add a convenience func for it:
|
||||||
self._getAuthHeaders(function (hErr, headers) {
|
self._getAuthHeaders(function (hErr, headers) {
|
||||||
if (hErr) {
|
if (hErr) {
|
||||||
callback(hErr);
|
callback(hErr);
|
||||||
|
@ -95,14 +95,14 @@ function kvToObj(kvs, valid) {
|
|||||||
var idx = kv.indexOf('=');
|
var idx = kv.indexOf('=');
|
||||||
if (idx === -1)
|
if (idx === -1)
|
||||||
throw new errors.UsageError(format(
|
throw new errors.UsageError(format(
|
||||||
'invalid filter: "%s" (must be of the form "field=value")',
|
'invalid filter: "%s" (must be of the form "field=value")',
|
||||||
kv));
|
kv));
|
||||||
var k = kv.slice(0, idx);
|
var k = kv.slice(0, idx);
|
||||||
var v = kv.slice(idx + 1);
|
var v = kv.slice(idx + 1);
|
||||||
if (valid.indexOf(k) === -1)
|
if (valid.indexOf(k) === -1)
|
||||||
throw new errors.UsageError(format(
|
throw new errors.UsageError(format(
|
||||||
'invalid filter name: "%s" (must be one of "%s")',
|
'invalid filter name: "%s" (must be one of "%s")',
|
||||||
k, valid.join('", "')));
|
k, valid.join('", "')));
|
||||||
o[k] = v;
|
o[k] = v;
|
||||||
}
|
}
|
||||||
return o;
|
return o;
|
||||||
|
@ -12,7 +12,8 @@ var common = require('./common');
|
|||||||
var errors = require('./errors');
|
var errors = require('./errors');
|
||||||
|
|
||||||
|
|
||||||
var DEFAULT_USER_CONFIG_PATH = path.resolve(process.env.HOME, '.triton', 'config.json');
|
var DEFAULT_USER_CONFIG_PATH = path.resolve(process.env.HOME,
|
||||||
|
'.triton', 'config.json');
|
||||||
var DEFAULTS_PATH = path.resolve(__dirname, '..', 'etc', 'defaults.json');
|
var DEFAULTS_PATH = path.resolve(__dirname, '..', 'etc', 'defaults.json');
|
||||||
var OVERRIDE_KEYS = []; // config object keys to do a one-level deep override
|
var OVERRIDE_KEYS = []; // config object keys to do a one-level deep override
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
var http = require('http');
|
var http = require('http');
|
||||||
|
|
||||||
function do_cloudapi (subcmd, opts, args, callback) {
|
function do_cloudapi(subcmd, opts, args, callback) {
|
||||||
if (opts.help) {
|
if (opts.help) {
|
||||||
this.do_help('help', {}, [subcmd], callback);
|
this.do_help('help', {}, [subcmd], callback);
|
||||||
return;
|
return;
|
||||||
|
@ -82,7 +82,7 @@ function do_create_instance(subcmd, opts, args, callback) {
|
|||||||
name: 'm00'
|
name: 'm00'
|
||||||
};
|
};
|
||||||
console.log('Creating instance %s (%s, %s@%s)',
|
console.log('Creating instance %s (%s, %s@%s)',
|
||||||
ctx.inst.name, ctx.inst.id,
|
ctx.inst.name, ctx.inst.id,
|
||||||
ctx.img.name, ctx.img.version);
|
ctx.img.name, ctx.img.version);
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
|
@ -31,13 +31,15 @@ function do_instance_audit(subcmd, opts, args, callback) {
|
|||||||
if (opts.json) {
|
if (opts.json) {
|
||||||
common.jsonStream(audit);
|
common.jsonStream(audit);
|
||||||
} else {
|
} else {
|
||||||
return callback(new errors.InternalError("tabular output for audit NYI")); // XXX
|
// XXX what to tabulate here?
|
||||||
//common.tabulate(audit, {
|
return callback(
|
||||||
|
new errors.InternalError('tabular output for audit NYI'));
|
||||||
|
// common.tabulate(audit, {
|
||||||
// columns: 'dc,id,name,state,created',
|
// columns: 'dc,id,name,state,created',
|
||||||
// sort: 'created',
|
// sort: 'created',
|
||||||
// validFields: 'dc,id,name,type,state,image,package,memory,'
|
// validFields: 'dc,id,name,type,state,image,package,memory,'
|
||||||
// + 'disk,created,updated,compute_node,primaryIp'
|
// + 'disk,created,updated,compute_node,primaryIp'
|
||||||
//});
|
// });
|
||||||
}
|
}
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
|
@ -8,7 +8,7 @@ var tabula = require('tabula');
|
|||||||
|
|
||||||
var common = require('./common');
|
var common = require('./common');
|
||||||
|
|
||||||
function do_packages (subcmd, opts, args, callback) {
|
function do_packages(subcmd, opts, args, callback) {
|
||||||
if (opts.help) {
|
if (opts.help) {
|
||||||
this.do_help('help', {}, [subcmd], callback);
|
this.do_help('help', {}, [subcmd], callback);
|
||||||
return;
|
return;
|
||||||
|
@ -8,7 +8,7 @@ var common = require('./common');
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function do_profile (subcmd, opts, args, callback) {
|
function do_profile(subcmd, opts, args, callback) {
|
||||||
if (opts.help) {
|
if (opts.help) {
|
||||||
this.do_help('help', {}, [subcmd], callback);
|
this.do_help('help', {}, [subcmd], callback);
|
||||||
return;
|
return;
|
||||||
|
@ -20,6 +20,7 @@ function do_wait_instance(subcmd, opts, args, cb) {
|
|||||||
var ids = args;
|
var ids = args;
|
||||||
var states = [];
|
var states = [];
|
||||||
opts.states.forEach(function (s) {
|
opts.states.forEach(function (s) {
|
||||||
|
/* JSSTYLED */
|
||||||
states = states.concat(s.trim().split(/\s*,\s*/g));
|
states = states.concat(s.trim().split(/\s*,\s*/g));
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -65,8 +66,8 @@ function do_wait_instance(subcmd, opts, args, cb) {
|
|||||||
idsToWaitFor.length, states.join(', '));
|
idsToWaitFor.length, states.join(', '));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (false /* TODO: need BigSpinner.log first */
|
if (false && /* TODO: need BigSpinner.log first */
|
||||||
&& !opts.quiet && process.stderr.isTTY)
|
!opts.quiet && process.stderr.isTTY)
|
||||||
{
|
{
|
||||||
distraction = distractions.createDistraction();
|
distraction = distractions.createDistraction();
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,9 @@ var format = require('util').format;
|
|||||||
var once = require('once');
|
var once = require('once');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var restifyClients = require('restify-clients');
|
var restifyClients = require('restify-clients');
|
||||||
|
// We are cheating here. restify-clients should export its 'bunyan'.
|
||||||
|
var restifyBunyanSerializers =
|
||||||
|
require('restify-clients/lib/helpers/bunyan').serializers;
|
||||||
var tabula = require('tabula');
|
var tabula = require('tabula');
|
||||||
var vasync = require('vasync');
|
var vasync = require('vasync');
|
||||||
|
|
||||||
@ -51,8 +54,7 @@ function Triton(options) {
|
|||||||
(!options.log.serializers.client_req ||
|
(!options.log.serializers.client_req ||
|
||||||
!options.log.serializers.client_req)) {
|
!options.log.serializers.client_req)) {
|
||||||
this.log = options.log.child({
|
this.log = options.log.child({
|
||||||
// XXX cheating. restify-clients should export its 'bunyan'.
|
serializers: restifyBunyanSerializers
|
||||||
serializers: require('restify-clients/lib/helpers/bunyan').serializers
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.log = options.log;
|
this.log = options.log;
|
||||||
@ -142,8 +144,8 @@ Triton.prototype.listImages = function listImages(opts, cb) {
|
|||||||
if (opts.useCache) {
|
if (opts.useCache) {
|
||||||
fs.readFile(cacheFile, 'utf8', function (err, out) {
|
fs.readFile(cacheFile, 'utf8', function (err, out) {
|
||||||
if (err) {
|
if (err) {
|
||||||
self.log.info({err: err}, 'failed to read cache file %s',
|
self.log.info({err: err, cacheFile: cacheFile},
|
||||||
cacheFile);
|
'failed to read cache file');
|
||||||
fetch();
|
fetch();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -151,7 +153,8 @@ Triton.prototype.listImages = function listImages(opts, cb) {
|
|||||||
try {
|
try {
|
||||||
data = JSON.parse(out);
|
data = JSON.parse(out);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
self.log.info({err: e}, 'failed to parse cache file %s', cacheFile);
|
self.log.info({err: e, cacheFile: cacheFile},
|
||||||
|
'failed to parse cache file');
|
||||||
fetch();
|
fetch();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -167,9 +170,12 @@ Triton.prototype.listImages = function listImages(opts, cb) {
|
|||||||
if (!err && self.cacheDir) {
|
if (!err && self.cacheDir) {
|
||||||
// cache the results
|
// cache the results
|
||||||
var data = JSON.stringify(imgs);
|
var data = JSON.stringify(imgs);
|
||||||
fs.writeFile(cacheFile, data, {encoding: 'utf8'}, function (err2) {
|
fs.writeFile(cacheFile, data, {encoding: 'utf8'},
|
||||||
if (err2)
|
function (err2) {
|
||||||
self.log.info({err: err2}, 'error caching images results');
|
if (err2) {
|
||||||
|
self.log.info({err: err2},
|
||||||
|
'error caching images results');
|
||||||
|
}
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user