'make check-jsl' clean

This commit is contained in:
Trent Mick 2015-09-01 09:00:45 -07:00
parent 42f0ee5a41
commit 9241f90ccf
11 changed files with 40 additions and 44 deletions

View File

@ -24,8 +24,6 @@
*
*/
var p = console.log;
var assert = require('assert-plus');
var auth = require('smartdc-auth');
var format = require('util').format;
@ -215,8 +213,13 @@ CloudAPI.prototype._request = function _request(options, callback) {
assert.ok(['get', 'post', 'delete', 'head'].indexOf(method) >= 0,
'invalid method given');
switch (method) {
case 'delete': method = 'del'; break;
case 'delete':
method = 'del';
break;
default:
break;
}
self._getAuthHeaders(function (err, headers) {
if (err) {
callback(err);

View File

@ -221,6 +221,7 @@ function humanSizeFromBytes(opts, bytes) {
}
} else if (opts.narrow && !hasDecimal) {
/* skip all-zero precision */
/* jsl:pass */
} else {
if (!hasDecimal) {
s += '.';
@ -269,13 +270,12 @@ function normShortId(s) {
shortId = shortId.replace(/-+$/, '');
} else {
// UUID prefix.
var shortId = '';
var chunk;
shortId = '';
var remaining = s;
var spans = [8, 4, 4, 4, 12];
for (var i = 0; i < spans.length; i++) {
var span = spans[i];
head = remaining.slice(0, span);
var head = remaining.slice(0, span);
remaining = remaining.slice(span + 1);
if (!shortIdCharsRe.test(head)) {
return;

View File

@ -73,17 +73,6 @@ function loadConfigSync(opts) {
}
/**
* Apply the given key:value updates to the user config and save it out.
*
* @param config {Object} The loaded config, as from `loadConfigSync`.
* @param updates {Object} key/value pairs to update.
*/
function updateUserConfigSync(config, updates) {
XXX
///XXX START HERE: to implement for 'sdc dcs add foo bar'
}
//---- exports

View File

@ -12,7 +12,7 @@ var path = require('path');
function do_badger(subcmd, opts, args, callback) {
var callbackOnce = once(callback);
var badger = path.resolve(__dirname, '../etc/badger');
var input = fs.createReadStream(badger)
var input = fs.createReadStream(badger);
input.pipe(process.stdout);
input.on('error', function (err) {
callbackOnce(err);
@ -20,10 +20,10 @@ function do_badger(subcmd, opts, args, callback) {
input.on('end', function () {
callbackOnce();
});
};
}
do_badger.options = [];
do_badger.help = 'Rawr!';
do_badger.help = 'Badger don\'t care.';
do_badger.hidden = true;
module.exports = do_badger;

View File

@ -25,7 +25,6 @@ function do_create_instance(subcmd, opts, args, callback) {
var log = this.triton.log;
var cloudapi = this.triton.cloudapi;
var cOpts = {};
vasync.pipeline({arg: {}, funcs: [
function getImg(ctx, next) {
@ -78,13 +77,13 @@ function do_create_instance(subcmd, opts, args, callback) {
'create-instance createOpts');
ctx.start = Date.now();
if (opts.dry_run) {
var inst = ctx.inst = {
ctx.inst = {
id: 'beefbeef-4c0e-11e5-86cd-a7fd38d2a50b',
name: 'm00'
};
console.log('Creating instance %s (%s, %s@%s%s)',
inst.name, inst.id, ctx.img.name, ctx.img.version,
inst.package ? format(', %s', inst.package) : '');
console.log('Creating instance %s (%s, %s@%s)',
ctx.inst.name, ctx.inst.id,
ctx.img.name, ctx.img.version);
return next();
}
@ -160,7 +159,7 @@ function do_create_instance(subcmd, opts, args, callback) {
]}, function (err) {
callback(err);
});
};
}
do_create_instance.options = [
{

View File

@ -30,7 +30,7 @@ function do_image(subcmd, opts, args, callback) {
}
callback();
});
};
}
do_image.options = [
{

View File

@ -81,7 +81,7 @@ function do_images(subcmd, opts, args, callback) {
}
callback();
});
};
}
do_images.options = [
{

View File

@ -7,11 +7,11 @@
var format = require('util').format;
var tabula = require('tabula');
var common = require('./common');
var errors = require('./errors');
function do_instance_audit(subcmd, opts, args, callback) {
var self = this;
if (opts.help) {
this.do_help('help', {}, [subcmd], callback);
return;
@ -29,9 +29,9 @@ function do_instance_audit(subcmd, opts, args, callback) {
audit[i].dc = dc;
}
if (opts.json) {
p(JSON.stringify(audit, null, 4));
common.jsonStream(audit);
} else {
return callback(new error.InternalError("tabular output for audit NYI")); // XXX
return callback(new errors.InternalError("tabular output for audit NYI")); // XXX
//common.tabulate(audit, {
// columns: 'dc,id,name,state,created',
// sort: 'created',
@ -41,7 +41,8 @@ function do_instance_audit(subcmd, opts, args, callback) {
}
callback();
});
};
}
do_instance_audit.options = [
{
names: ['help', 'h'],

View File

@ -30,7 +30,7 @@ function do_package(subcmd, opts, args, callback) {
}
callback();
});
};
}
do_package.options = [
{

View File

@ -24,7 +24,7 @@ function do_profile (subcmd, opts, args, callback) {
.join(',');
}
if (opts.json) {
p(JSON.stringify(profs, null, 4));
common.jsonStream(profs);
} else {
common.tabulate(profs, {
columns: 'curr,name,dcs,user,keyId',
@ -33,7 +33,7 @@ function do_profile (subcmd, opts, args, callback) {
});
}
callback();
};
}
do_profile.options = [
{
@ -57,4 +57,4 @@ do_profile.help = (
);
module.exports = do_profile;
module.exports = do_profile;

View File

@ -37,7 +37,7 @@ function do_startstop_instance(action) {
names: ['wait', 'w'],
type: 'bool',
help: 'Block until desired state is reached.'
},
}
];
return _do_startstop_instance;
@ -66,6 +66,9 @@ function _do_instance(action, subcmd, opts, args, callback) {
command = 'deleteMachine';
state = 'deleted';
break;
default:
callback(new Error('unknown action: ' + action));
break;
}
if (opts.help) {
@ -83,13 +86,13 @@ function _do_instance(action, subcmd, opts, args, callback) {
uuid = arg;
go1();
} else {
self.triton.getInstance(arg, function (err, machine) {
self.triton.getInstance(arg, function (err, inst) {
if (err) {
callback(err);
return;
}
alias = arg;
uuid = machine.id;
uuid = inst.id;
go1();
});
}
@ -116,11 +119,12 @@ function _do_instance(action, subcmd, opts, args, callback) {
self.triton.cloudapi.waitForMachineStates({
id: uuid,
states: [state]
}, function (err, machine, res) {
if (action === 'delete' && res && res.statusCode === 410) {
// this is success, fall through to bottom
} else if (err) {
callback(err);
}, function (err2, inst2, res2) {
if (action === 'delete' && res2 && res2.statusCode === 410) {
// This is success, fall through to bottom.
/* jsl:pass */
} else if (err2) {
callback(err2);
return;
}