'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
|
||||
* 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.ok(subpath[0] === '/');
|
||||
|
||||
@ -301,7 +301,8 @@ CloudAPI.prototype.listServices = function listServices(opts, cb) {
|
||||
/**
|
||||
* 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) {
|
||||
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
|
||||
* @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;
|
||||
assert.object(opts, 'opts');
|
||||
assert.string(opts.id, 'opts.id');
|
||||
@ -618,7 +620,7 @@ CloudAPI.prototype.machineAudit = function machineAudit(options, callback) {
|
||||
assert.func(callback, 'callback');
|
||||
|
||||
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) {
|
||||
if (hErr) {
|
||||
callback(hErr);
|
||||
|
@ -95,14 +95,14 @@ function kvToObj(kvs, valid) {
|
||||
var idx = kv.indexOf('=');
|
||||
if (idx === -1)
|
||||
throw new errors.UsageError(format(
|
||||
'invalid filter: "%s" (must be of the form "field=value")',
|
||||
kv));
|
||||
'invalid filter: "%s" (must be of the form "field=value")',
|
||||
kv));
|
||||
var k = kv.slice(0, idx);
|
||||
var v = kv.slice(idx + 1);
|
||||
if (valid.indexOf(k) === -1)
|
||||
throw new errors.UsageError(format(
|
||||
'invalid filter name: "%s" (must be one of "%s")',
|
||||
k, valid.join('", "')));
|
||||
'invalid filter name: "%s" (must be one of "%s")',
|
||||
k, valid.join('", "')));
|
||||
o[k] = v;
|
||||
}
|
||||
return o;
|
||||
|
@ -12,7 +12,8 @@ var common = require('./common');
|
||||
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 OVERRIDE_KEYS = []; // config object keys to do a one-level deep override
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
var http = require('http');
|
||||
|
||||
function do_cloudapi (subcmd, opts, args, callback) {
|
||||
function do_cloudapi(subcmd, opts, args, callback) {
|
||||
if (opts.help) {
|
||||
this.do_help('help', {}, [subcmd], callback);
|
||||
return;
|
||||
|
@ -31,13 +31,15 @@ function do_instance_audit(subcmd, opts, args, callback) {
|
||||
if (opts.json) {
|
||||
common.jsonStream(audit);
|
||||
} else {
|
||||
return callback(new errors.InternalError("tabular output for audit NYI")); // XXX
|
||||
//common.tabulate(audit, {
|
||||
// XXX what to tabulate here?
|
||||
return callback(
|
||||
new errors.InternalError('tabular output for audit NYI'));
|
||||
// common.tabulate(audit, {
|
||||
// columns: 'dc,id,name,state,created',
|
||||
// sort: 'created',
|
||||
// validFields: 'dc,id,name,type,state,image,package,memory,'
|
||||
// + 'disk,created,updated,compute_node,primaryIp'
|
||||
//});
|
||||
// });
|
||||
}
|
||||
callback();
|
||||
});
|
||||
|
@ -8,7 +8,7 @@ var tabula = require('tabula');
|
||||
|
||||
var common = require('./common');
|
||||
|
||||
function do_packages (subcmd, opts, args, callback) {
|
||||
function do_packages(subcmd, opts, args, callback) {
|
||||
if (opts.help) {
|
||||
this.do_help('help', {}, [subcmd], callback);
|
||||
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) {
|
||||
this.do_help('help', {}, [subcmd], callback);
|
||||
return;
|
||||
|
@ -20,6 +20,7 @@ function do_wait_instance(subcmd, opts, args, cb) {
|
||||
var ids = args;
|
||||
var states = [];
|
||||
opts.states.forEach(function (s) {
|
||||
/* JSSTYLED */
|
||||
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(', '));
|
||||
}
|
||||
|
||||
if (false /* TODO: need BigSpinner.log first */
|
||||
&& !opts.quiet && process.stderr.isTTY)
|
||||
if (false && /* TODO: need BigSpinner.log first */
|
||||
!opts.quiet && process.stderr.isTTY)
|
||||
{
|
||||
distraction = distractions.createDistraction();
|
||||
}
|
||||
|
@ -13,6 +13,9 @@ var format = require('util').format;
|
||||
var once = require('once');
|
||||
var path = require('path');
|
||||
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 vasync = require('vasync');
|
||||
|
||||
@ -51,8 +54,7 @@ function Triton(options) {
|
||||
(!options.log.serializers.client_req ||
|
||||
!options.log.serializers.client_req)) {
|
||||
this.log = options.log.child({
|
||||
// XXX cheating. restify-clients should export its 'bunyan'.
|
||||
serializers: require('restify-clients/lib/helpers/bunyan').serializers
|
||||
serializers: restifyBunyanSerializers
|
||||
});
|
||||
} else {
|
||||
this.log = options.log;
|
||||
@ -142,8 +144,8 @@ Triton.prototype.listImages = function listImages(opts, cb) {
|
||||
if (opts.useCache) {
|
||||
fs.readFile(cacheFile, 'utf8', function (err, out) {
|
||||
if (err) {
|
||||
self.log.info({err: err}, 'failed to read cache file %s',
|
||||
cacheFile);
|
||||
self.log.info({err: err, cacheFile: cacheFile},
|
||||
'failed to read cache file');
|
||||
fetch();
|
||||
return;
|
||||
}
|
||||
@ -151,7 +153,8 @@ Triton.prototype.listImages = function listImages(opts, cb) {
|
||||
try {
|
||||
data = JSON.parse(out);
|
||||
} 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();
|
||||
return;
|
||||
}
|
||||
@ -167,9 +170,12 @@ Triton.prototype.listImages = function listImages(opts, cb) {
|
||||
if (!err && self.cacheDir) {
|
||||
// cache the results
|
||||
var data = JSON.stringify(imgs);
|
||||
fs.writeFile(cacheFile, data, {encoding: 'utf8'}, function (err2) {
|
||||
if (err2)
|
||||
self.log.info({err: err2}, 'error caching images results');
|
||||
fs.writeFile(cacheFile, data, {encoding: 'utf8'},
|
||||
function (err2) {
|
||||
if (err2) {
|
||||
self.log.info({err: err2},
|
||||
'error caching images results');
|
||||
}
|
||||
done();
|
||||
});
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user