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

View File

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

View File

@ -31,7 +31,9 @@ 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
// 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',

View File

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

View File

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