'make check' clean

This commit is contained in:
Trent Mick 2015-09-02 10:47:06 -07:00
parent db81ff9db2
commit 018c46ef43
10 changed files with 38 additions and 26 deletions

View File

@ -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);

View File

@ -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

View File

@ -31,7 +31,9 @@ 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?
return callback(
new errors.InternalError('tabular output for audit NYI'));
// common.tabulate(audit, { // common.tabulate(audit, {
// columns: 'dc,id,name,state,created', // columns: 'dc,id,name,state,created',
// sort: 'created', // sort: 'created',

View File

@ -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();
} }

View File

@ -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 {