node-triton icon indicating copy to clipboard operation
node-triton copied to clipboard

`triton profile set NAME` and `TRITON_PROFILE` interaction is confusing

Open trentm opened this issue 9 years ago • 4 comments

(From a conversation with @STRML on #joyent IRC.)

How a triton invocation determines the profile to use can be confusing. If you use the suggested eval $(triton env) technique to setup one's env for docker usage, one may not realize that the TRITON_PROFILE envvar is being set to the current profile. Subsequent attempts to "set" one's profile with triton profile set NAME will report success, but really you won't get that profile for triton commands because the TRITON_PROFILE envvar will win.

Further possible confusion is how the "env" profile works. The "env" profile automatically exists if one has SDC_ and/or TRITON_{URL|ACCOUNT|...} envvars set. So, in the case above one might not have had an "env" profile in triton profile list ... until eval $(triton env) was run. Now there is this new "env" profile. Are the SDC_ envvars now used by triton commands? The answer is: only if the "env" profile is the current one.

Suggested changes:

  • triton profile set-current (and its set shortcut) are misleading. They are really about setting the default profile (if neither of a -p NAME top-level option or TRITON_PROFILE envvar are used to explicitly choose the profile). We should change to the set-default name and have hidden set and set-current aliases for bwcompat (which we can remove at some later major rev).
  • The docs in all of triton profile, triton env -h, and triton profile set-default -h should clarify how a profile is selected.
  • triton profile set-default FOO should emit a warning on stderr if it notices that TRITON_PROFILE is set or if -p NAME top-level opt is used.

trentm avatar Jun 14 '16 22:06 trentm

We should change to the set-default name and have hidden set and set-current aliases for bwcompat

I actually pushed a couple commits that address this over on my fork. I renamed the command and kept the existing set-current and set alias hidden in their own file do_set_current.js for future deprecation.

I'm new around here but I guess I need to send the PR through Gerrit?

jwreagor avatar May 19 '17 20:05 jwreagor

@cheapRoc That's right. There's some text in CONTRIBUTING.md about it, which also links to our guide for using the Joyent Gerrit.

jclulow avatar May 19 '17 20:05 jclulow

@jclulow Thanks, the link to the Joyent Gerrit info was what I overlooked.

jwreagor avatar May 19 '17 20:05 jwreagor

Posted to Gerrit.

FWIW My intention wasn't to solve the entire problem today but to at least get something in that might lead to clearing this up for users. Felt the confusion and wanted to see if I could help.

I've got more questions around how the env vars are loaded if that's worth posting here or somewhere else.

jwreagor avatar May 24 '17 03:05 jwreagor