better bessages for start/stop/reboot/delete

This commit is contained in:
Dave Eddy 2015-08-26 12:18:24 -04:00
parent 1d0fa26633
commit e2edbb3215
3 changed files with 24 additions and 17 deletions

View File

@ -9,11 +9,6 @@ triton create -n|--dry-run # does the fake delay, shows what img/pkg/etc.
image "name@version" in 'triton insts' table. Optionally?
delete, stop, start, reboot:
- print alias only if have it
- don't dupe the id in status line
- drop time from status line
# DONE
triton

View File

@ -20,7 +20,7 @@ function do_delete_instance(subcmd, opts, args, callback) {
}
var arg = args[0];
var uuid;
var uuid, alias;
if (common.isUUID(arg)) {
uuid = arg;
@ -31,6 +31,7 @@ function do_delete_instance(subcmd, opts, args, callback) {
callback(err);
return;
}
alias = arg;
uuid = machine.id;
go1();
});
@ -45,8 +46,10 @@ function do_delete_instance(subcmd, opts, args, callback) {
}
if (!opts.wait) {
console.log('Deleted (async) instance %s (id %s, %s)',
arg, uuid, common.humanDurationFromMs(Date.now() - now));
if (alias)
console.log('Deleted (async) instance %s (%s)', alias, uuid);
else
console.log('Deleted (async) instance %s', uuid);
callback();
return;
}
@ -57,8 +60,11 @@ function do_delete_instance(subcmd, opts, args, callback) {
}, function (err, machine, res) {
if (res && res.statusCode === 410) {
// gone... success!
console.log('Deleted instance %s (id %s, %s)',
arg, uuid, common.humanDurationFromMs(Date.now() - now));
var dur = common.humanDurationFromMs(Date.now() - now);
if (alias)
console.log('Deleted instance %s (%s, %s)', alias, uuid, dur);
else
console.log('Deleted instance %s (%s)', uuid, dur);
callback();
return;
} else if (err) {

View File

@ -2,6 +2,8 @@
* Copyright 2015 Joyent Inc.
*
* `triton stop-instance ...`
* `triton start-instance ...`
* `triton reboot-instance ...`
*/
var f = require('util').format;
@ -71,7 +73,7 @@ function _do_instance(action, subcmd, opts, args, callback) {
}
var arg = args[0];
var uuid;
var uuid, alias;
if (common.isUUID(arg)) {
uuid = arg;
@ -82,6 +84,7 @@ function _do_instance(action, subcmd, opts, args, callback) {
callback(err);
return;
}
alias = arg;
uuid = machine.id;
go1();
});
@ -96,9 +99,10 @@ function _do_instance(action, subcmd, opts, args, callback) {
}
if (!opts.wait) {
console.log('%s (async) instance %s (id %s, %s)',
common.capitalize(action), arg, uuid,
common.humanDurationFromMs(Date.now() - now));
if (alias)
console.log('%s (async) instance %s (%s)', common.capitalize(action), alias, uuid);
else
console.log('%s (async) instance %s', common.capitalize(action), uuid);
callback();
return;
}
@ -111,9 +115,11 @@ function _do_instance(action, subcmd, opts, args, callback) {
callback(err);
return;
}
console.log('%s instance %s (id %s, %s)',
common.capitalize(action), arg, uuid,
common.humanDurationFromMs(Date.now() - now));
var dur = common.humanDurationFromMs(Date.now() - now);
if (alias)
console.log('%s instance %s (%s, %s)', common.capitalize(action), alias, uuid, dur);
else
console.log('%s instance %s (%s)', common.capitalize(action), uuid, dur);
callback();
});
});