modified env vars and output texts

This commit is contained in:
Marius Pana 2018-02-10 18:36:28 +02:00
parent d589694608
commit 71f5d9568e
1 changed files with 21 additions and 26 deletions

View File

@ -58,9 +58,9 @@ var OPTIONS = [
names: ['profile', 'p'], names: ['profile', 'p'],
type: 'string', type: 'string',
completionType: 'tritonprofile', completionType: 'tritonprofile',
env: 'TRITON_PROFILE', env: 'SC_PROFILE',
helpArg: 'NAME', helpArg: 'NAME',
help: 'Triton client profile to use.' help: 'Spearhead Cloud client profile to use.'
}, },
{ {
@ -81,8 +81,7 @@ var OPTIONS = [
{ {
names: ['account', 'a'], names: ['account', 'a'],
type: 'string', type: 'string',
help: 'Account (login name). Environment: TRITON_ACCOUNT=ACCOUNT ' + help: 'Account (login name). Environment: SC_ACCOUNT=ACCOUNT ',
'or SDC_ACCOUNT=ACCOUNT.',
helpArg: 'ACCOUNT' helpArg: 'ACCOUNT'
}, },
{ {
@ -90,51 +89,48 @@ var OPTIONS = [
type: 'string', type: 'string',
help: 'Masquerade as the given account login name. This can only ' + help: 'Masquerade as the given account login name. This can only ' +
'succeed for operator accounts. Note that accesses like these ' + 'succeed for operator accounts. Note that accesses like these ' +
'audited on the CloudAPI server side.', 'are audited on the CloudAPI server side.',
helpArg: 'ACCOUNT', helpArg: 'ACCOUNT',
hidden: true hidden: true
}, },
{ {
names: ['user', 'u'], names: ['user', 'u'],
type: 'string', type: 'string',
help: 'RBAC user (login name). Environment: TRITON_USER=USER ' + help: 'RBAC user (login name). Environment: SC_USER=USER',
'or SDC_USER=USER.',
helpArg: 'USER' helpArg: 'USER'
}, },
{ {
names: ['role', 'r'], names: ['role', 'r'],
type: 'arrayOfCommaSepString', type: 'arrayOfCommaSepString',
env: 'TRITON_ROLE', env: 'SC_ROLE',
help: 'Assume an RBAC role. Use multiple times or once with a list', help: 'Assume an RBAC role. Use multiple times or once with a list',
helpArg: 'ROLE,...' helpArg: 'ROLE,...'
}, },
{ {
names: ['keyId', 'k'], names: ['keyId', 'k'],
type: 'string', type: 'string',
help: 'SSH key fingerprint. Environment: TRITON_KEY_ID=FINGERPRINT ' + help: 'SSH key fingerprint. Environment: SC_KEY_ID=FINGERPRINT.',
'or SDC_KEY_ID=FINGERPRINT.',
helpArg: 'FP' helpArg: 'FP'
}, },
{ {
names: ['url', 'U'], names: ['url', 'U'],
type: 'string', type: 'string',
help: 'CloudAPI URL. Environment: TRITON_URL=URL or SDC_URL=URL.', help: 'Spearhead Cloud Datacenter URL. Environment: SC_URL=URL.',
helpArg: 'URL' helpArg: 'URL'
}, },
{ {
names: ['J'], names: ['J'],
type: 'string', type: 'string',
hidden: true, hidden: true,
help: 'Joyent Public Cloud (JPC) datacenter name. This is ' + help: 'Spearhead Cloud (SC) datacenter name. This is ' +
'a shortcut to the "https://$dc.api.joyent.com" ' + 'a shortcut to the "https://$dc.api.spearhead.cloud" ' +
'cloudapi URL.' 'cloudapi URL.'
}, },
{ {
names: ['insecure', 'i'], names: ['insecure', 'i'],
type: 'bool', type: 'bool',
help: 'Do not validate the CloudAPI SSL certificate. Environment: ' + help: 'Do not validate the SSL certificate. Environment: ' +
'TRITON_TLS_INSECURE=1, SDC_TLS_INSECURE=1 (or the deprecated ' + 'SC_TLS_INSECURE=1 (or the deprecated SC_TESTING=1).',
'SDC_TESTING=1).',
'default': false 'default': false
}, },
{ {
@ -143,7 +139,7 @@ var OPTIONS = [
helpArg: 'VER', helpArg: 'VER',
help: 'A cloudapi API version, or semver range, to attempt to use. ' + help: 'A cloudapi API version, or semver range, to attempt to use. ' +
'This is passed in the "Accept-Version" header. ' + 'This is passed in the "Accept-Version" header. ' +
'See `triton cloudapi /--ping` to list supported versions. ' + 'See `spearhead cloudapi /--ping` to list supported versions. ' +
'The default is "' + lib_tritonapi.CLOUDAPI_ACCEPT_VERSION + '". ' + 'The default is "' + lib_tritonapi.CLOUDAPI_ACCEPT_VERSION + '". ' +
'*This is intended for development use only. It could cause ' + '*This is intended for development use only. It could cause ' +
'`triton` processing of responses to break.*', '`triton` processing of responses to break.*',
@ -258,7 +254,7 @@ CLI.prototype.init = function (opts, args, callback) {
callback(new errors.UsageError( callback(new errors.UsageError(
'cannot use both "--url" and "-J" options')); 'cannot use both "--url" and "-J" options'));
} else if (opts.J) { } else if (opts.J) {
opts.url = format('https://%s.api.joyent.com', opts.J); opts.url = format('https://%s.api.spearhead.cloud', opts.J);
} }
this.configDir = constants.CLI_CONFIG_DIR; this.configDir = constants.CLI_CONFIG_DIR;
@ -298,9 +294,8 @@ CLI.prototype.init = function (opts, args, callback) {
/* BEGIN JSSTYLED */ /* BEGIN JSSTYLED */
pErr.message += '\n' pErr.message += '\n'
+ ' No profile information could be loaded.\n' + ' No profile information could be loaded.\n'
+ ' Use "triton profile create" to create a profile or provide\n' + ' Use "spearhead profile create" to create a profile or provide\n'
+ ' the required "CloudAPI options" described in "triton --help".\n' + ' the required "CloudAPI options" described in "spearhead --help".';
+ ' See https://github.com/joyent/node-triton#setup for more help.';
/* END JSSTYLED */ /* END JSSTYLED */
} }
throw pErr; throw pErr;
@ -322,9 +317,9 @@ CLI.prototype.init = function (opts, args, callback) {
return self._tritonapi; return self._tritonapi;
}); });
if (process.env.TRITON_COMPLETE) { if (process.env.SC_COMPLETE) {
/* /*
* If `TRITON_COMPLETE=<type>` is set (typically only in the * If `SC_COMPLETE=<type>` is set (typically only in the
* Triton CLI bash completion driver, see * Triton CLI bash completion driver, see
* "etc/triton-bash-completion-types.sh"), then Bash completions are * "etc/triton-bash-completion-types.sh"), then Bash completions are
* fetched and printed, instead of the usual subcommand handling. * fetched and printed, instead of the usual subcommand handling.
@ -333,9 +328,9 @@ CLI.prototype.init = function (opts, args, callback) {
* to avoid hitting the server for data everytime. * to avoid hitting the server for data everytime.
* *
* Example usage: * Example usage:
* TRITON_COMPLETE=images triton -p my-profile create * SC_COMPLETE=images triton -p my-profile create
*/ */
self._emitCompletions(process.env.TRITON_COMPLETE, function (err) { self._emitCompletions(process.env.SC_COMPLETE, function (err) {
callback(err || false); callback(err || false);
}); });
} else { } else {
@ -559,7 +554,7 @@ CLI.prototype._emitCompletions = function _emitCompletions(type, cb) {
}); });
break; break;
default: default:
process.stderr.write('warning: unknown triton completion type: ' process.stderr.write('warning: unknown spearhead completion type: '
+ type + '\n'); + type + '\n');
next(); next();
break; break;