better bessages for start/stop/reboot/delete
This commit is contained in:
parent
1d0fa26633
commit
e2edbb3215
5
TODO.txt
5
TODO.txt
@ -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?
|
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
|
# DONE
|
||||||
|
|
||||||
triton
|
triton
|
||||||
|
@ -20,7 +20,7 @@ function do_delete_instance(subcmd, opts, args, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var arg = args[0];
|
var arg = args[0];
|
||||||
var uuid;
|
var uuid, alias;
|
||||||
|
|
||||||
if (common.isUUID(arg)) {
|
if (common.isUUID(arg)) {
|
||||||
uuid = arg;
|
uuid = arg;
|
||||||
@ -31,6 +31,7 @@ function do_delete_instance(subcmd, opts, args, callback) {
|
|||||||
callback(err);
|
callback(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
alias = arg;
|
||||||
uuid = machine.id;
|
uuid = machine.id;
|
||||||
go1();
|
go1();
|
||||||
});
|
});
|
||||||
@ -45,8 +46,10 @@ function do_delete_instance(subcmd, opts, args, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!opts.wait) {
|
if (!opts.wait) {
|
||||||
console.log('Deleted (async) instance %s (id %s, %s)',
|
if (alias)
|
||||||
arg, uuid, common.humanDurationFromMs(Date.now() - now));
|
console.log('Deleted (async) instance %s (%s)', alias, uuid);
|
||||||
|
else
|
||||||
|
console.log('Deleted (async) instance %s', uuid);
|
||||||
callback();
|
callback();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -57,8 +60,11 @@ function do_delete_instance(subcmd, opts, args, callback) {
|
|||||||
}, function (err, machine, res) {
|
}, function (err, machine, res) {
|
||||||
if (res && res.statusCode === 410) {
|
if (res && res.statusCode === 410) {
|
||||||
// gone... success!
|
// gone... success!
|
||||||
console.log('Deleted instance %s (id %s, %s)',
|
var dur = common.humanDurationFromMs(Date.now() - now);
|
||||||
arg, uuid, 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();
|
callback();
|
||||||
return;
|
return;
|
||||||
} else if (err) {
|
} else if (err) {
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
* Copyright 2015 Joyent Inc.
|
* Copyright 2015 Joyent Inc.
|
||||||
*
|
*
|
||||||
* `triton stop-instance ...`
|
* `triton stop-instance ...`
|
||||||
|
* `triton start-instance ...`
|
||||||
|
* `triton reboot-instance ...`
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var f = require('util').format;
|
var f = require('util').format;
|
||||||
@ -71,7 +73,7 @@ function _do_instance(action, subcmd, opts, args, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var arg = args[0];
|
var arg = args[0];
|
||||||
var uuid;
|
var uuid, alias;
|
||||||
|
|
||||||
if (common.isUUID(arg)) {
|
if (common.isUUID(arg)) {
|
||||||
uuid = arg;
|
uuid = arg;
|
||||||
@ -82,6 +84,7 @@ function _do_instance(action, subcmd, opts, args, callback) {
|
|||||||
callback(err);
|
callback(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
alias = arg;
|
||||||
uuid = machine.id;
|
uuid = machine.id;
|
||||||
go1();
|
go1();
|
||||||
});
|
});
|
||||||
@ -96,9 +99,10 @@ function _do_instance(action, subcmd, opts, args, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!opts.wait) {
|
if (!opts.wait) {
|
||||||
console.log('%s (async) instance %s (id %s, %s)',
|
if (alias)
|
||||||
common.capitalize(action), arg, uuid,
|
console.log('%s (async) instance %s (%s)', common.capitalize(action), alias, uuid);
|
||||||
common.humanDurationFromMs(Date.now() - now));
|
else
|
||||||
|
console.log('%s (async) instance %s', common.capitalize(action), uuid);
|
||||||
callback();
|
callback();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -111,9 +115,11 @@ function _do_instance(action, subcmd, opts, args, callback) {
|
|||||||
callback(err);
|
callback(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log('%s instance %s (id %s, %s)',
|
var dur = common.humanDurationFromMs(Date.now() - now);
|
||||||
common.capitalize(action), arg, uuid,
|
if (alias)
|
||||||
common.humanDurationFromMs(Date.now() - now));
|
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();
|
callback();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user