joyent/node-triton#182 'triton profile create' and 'triton profile docker-setup' need a non-interactive option
Reviewed by: Todd Whiteman <todd.whiteman@joyent.com> Approved by: Todd Whiteman <todd.whiteman@joyent.com>
This commit is contained in:
parent
d91e0326c2
commit
b66939751d
@ -7,6 +7,10 @@ Known issues:
|
|||||||
|
|
||||||
## not yet released
|
## not yet released
|
||||||
|
|
||||||
|
## 5.1.0
|
||||||
|
|
||||||
|
- [joyent/node-triton#182] Add `-y, --yes` options to `triton profile create`
|
||||||
|
and `triton profile docker-setup` to allow non-interactive setup.
|
||||||
|
|
||||||
## 5.0.0
|
## 5.0.0
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ function _createProfile(opts, cb) {
|
|||||||
assert.optionalString(opts.file, 'opts.file');
|
assert.optionalString(opts.file, 'opts.file');
|
||||||
assert.optionalString(opts.copy, 'opts.copy');
|
assert.optionalString(opts.copy, 'opts.copy');
|
||||||
assert.optionalBool(opts.noDocker, 'opts.noDocker');
|
assert.optionalBool(opts.noDocker, 'opts.noDocker');
|
||||||
|
assert.optionalBool(opts.yes, 'opts.yes');
|
||||||
assert.func(cb, 'cb');
|
assert.func(cb, 'cb');
|
||||||
var cli = opts.cli;
|
var cli = opts.cli;
|
||||||
var log = cli.log;
|
var log = cli.log;
|
||||||
@ -366,7 +367,8 @@ function _createProfile(opts, cb) {
|
|||||||
cli: cli,
|
cli: cli,
|
||||||
name: data.name,
|
name: data.name,
|
||||||
keyPaths: ctx.keyPaths,
|
keyPaths: ctx.keyPaths,
|
||||||
implicit: true
|
implicit: true,
|
||||||
|
yes: opts.yes
|
||||||
}, next);
|
}, next);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -411,7 +413,8 @@ function do_create(subcmd, opts, args, cb) {
|
|||||||
cli: this.top,
|
cli: this.top,
|
||||||
file: opts.file,
|
file: opts.file,
|
||||||
copy: opts.copy,
|
copy: opts.copy,
|
||||||
noDocker: opts.no_docker
|
noDocker: opts.no_docker,
|
||||||
|
yes: opts.yes
|
||||||
}, cb);
|
}, cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -442,6 +445,11 @@ do_create.options = [
|
|||||||
+ 'non-Windows) to also setup for running Docker. This is '
|
+ 'non-Windows) to also setup for running Docker. This is '
|
||||||
+ 'experimental and might fail. Use this option to disable '
|
+ 'experimental and might fail. Use this option to disable '
|
||||||
+ 'the attempt.'
|
+ 'the attempt.'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
names: ['yes', 'y'],
|
||||||
|
type: 'bool',
|
||||||
|
help: 'Answer yes to any confirmations.'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -21,7 +21,9 @@ function do_docker_setup(subcmd, opts, args, cb) {
|
|||||||
var profileName = args[0] || this.top.tritonapi.profile.name;
|
var profileName = args[0] || this.top.tritonapi.profile.name;
|
||||||
profilecommon.profileDockerSetup({
|
profilecommon.profileDockerSetup({
|
||||||
cli: this.top,
|
cli: this.top,
|
||||||
name: profileName
|
name: profileName,
|
||||||
|
implicit: false,
|
||||||
|
yes: opts.yes
|
||||||
}, cb);
|
}, cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,6 +32,11 @@ do_docker_setup.options = [
|
|||||||
names: ['help', 'h'],
|
names: ['help', 'h'],
|
||||||
type: 'bool',
|
type: 'bool',
|
||||||
help: 'Show this help.'
|
help: 'Show this help.'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
names: ['yes', 'y'],
|
||||||
|
type: 'bool',
|
||||||
|
help: 'Answer yes to any confirmations.'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -141,17 +141,21 @@ function setCurrentProfile(opts, cb) {
|
|||||||
* - {Boolean} implicit: Optional. Boolean indicating if the Docker setup
|
* - {Boolean} implicit: Optional. Boolean indicating if the Docker setup
|
||||||
* is implicit (e.g. as a default part of `triton profile create`). If
|
* is implicit (e.g. as a default part of `triton profile create`). If
|
||||||
* implicit, we silently skip if ListServices shows no Docker service.
|
* implicit, we silently skip if ListServices shows no Docker service.
|
||||||
|
* - {Boolean} yes: Optional. Boolean indicating if confirmation prompts
|
||||||
|
* should be skipped, assuming a "yes" answer.
|
||||||
*/
|
*/
|
||||||
function profileDockerSetup(opts, cb) {
|
function profileDockerSetup(opts, cb) {
|
||||||
assert.object(opts.cli, 'opts.cli');
|
assert.object(opts.cli, 'opts.cli');
|
||||||
assert.string(opts.name, 'opts.name');
|
assert.string(opts.name, 'opts.name');
|
||||||
assert.optionalBool(opts.implicit, 'opts.implicit');
|
assert.optionalBool(opts.implicit, 'opts.implicit');
|
||||||
|
assert.optionalBool(opts.yes, 'opts.yes');
|
||||||
assert.func(cb, 'cb');
|
assert.func(cb, 'cb');
|
||||||
|
|
||||||
var cli = opts.cli;
|
var cli = opts.cli;
|
||||||
var tritonapi = cli.tritonapiFromProfileName({profileName: opts.name});
|
var tritonapi = cli.tritonapiFromProfileName({profileName: opts.name});
|
||||||
|
|
||||||
var implicit = Boolean(opts.implicit);
|
var implicit = Boolean(opts.implicit);
|
||||||
|
var yes = Boolean(opts.yes);
|
||||||
var log = cli.log;
|
var log = cli.log;
|
||||||
|
|
||||||
var profile = tritonapi.profile;
|
var profile = tritonapi.profile;
|
||||||
@ -165,6 +169,10 @@ function profileDockerSetup(opts, cb) {
|
|||||||
'this profile setup will attempt to write a copy of your ' +
|
'this profile setup will attempt to write a copy of your ' +
|
||||||
'SSH private key formatted as an unencrypted TLS certificate ' +
|
'SSH private key formatted as an unencrypted TLS certificate ' +
|
||||||
'in "~/.triton/docker" for use by the Docker client.\n'));
|
'in "~/.triton/docker" for use by the Docker client.\n'));
|
||||||
|
if (yes) {
|
||||||
|
next();
|
||||||
|
return;
|
||||||
|
}
|
||||||
common.promptYesNo({msg: 'Continue? [y/n] '}, function (answer) {
|
common.promptYesNo({msg: 'Continue? [y/n] '}, function (answer) {
|
||||||
if (answer !== 'y') {
|
if (answer !== 'y') {
|
||||||
console.error('Skipping Docker setup (you can run '
|
console.error('Skipping Docker setup (you can run '
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "triton",
|
"name": "triton",
|
||||||
"description": "Joyent Triton CLI and client (https://www.joyent.com/triton)",
|
"description": "Joyent Triton CLI and client (https://www.joyent.com/triton)",
|
||||||
"version": "5.0.0",
|
"version": "5.1.0",
|
||||||
"author": "Joyent (joyent.com)",
|
"author": "Joyent (joyent.com)",
|
||||||
"homepage": "https://github.com/joyent/node-triton",
|
"homepage": "https://github.com/joyent/node-triton",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
Reference in New Issue
Block a user