Open warrenvw opened 7 years ago
Thanks for reporting this.
AFAIK, st2-self-check
was never really tested with CLI auth token caching since it was always designed to run using an explicit auth token specified as ST2_AUTH_TOKEN
environment variable.
In any case, still something we should check out when we get a chance and I would also be OK with making it work with existing cached auth token (if it's not too complicated and involves too much refactoring).
Yes, it's true that st2-self-check
does explicitly use the ST2_AUTH_TOKEN
env variable when calling st2 run ...
. However, it's also true that the --debug
output shows that it's properly reading and using the token from ~/.ssh/token-st2admin
. It's clear something isn't working right server-side.
For the time being, I'll explicitly set ST2_AUTH_TOKEN
when running st2-self-check
.
OK, I just checked the st2-self-check to confirm and ST2_AUTH_TOKEN
environment variable is mandatory when auth is enabled - https://github.com/StackStorm/st2/blob/master/st2common/bin/st2-self-check#L118.
The reason for that is that this token is passed to the tests as token
parameter. So in short, it works as designed.
So yeah, it's slightly confusing, but the same token is used by st2 CLI and also used by tests on the server side.
Having said that, I still think the output and behavior is confusing and we should at the very least throw if mandatory ST2_AUTH_TOKEN
environment variable is not set for the script run. Only small problem with that is that token shouldn't really be required in case auth is not supported, but auth has been enabled by default for a very long time so this shouldn't be an issue.
So if you feel adventurous you can add a small "if and exit 2 if this variable is not set". This should be the easy part, the hard / time-consuming part will be taking the change all the way through and making sure all the builds pass, etc. :)
cc @Kami
Context: ST2 2.2.0 without
$ST2_AUTH_TOKEN
environment variable set, but after successfully runningst2 login
.st2-self-check
fails execution. It appears the auth token is not propagated successfully.Here's the output from the first failed command run by
st2-self-check
(run manually:st2 --debug run tests.test_packs_pack
):Note the last curl request contains an
X-Auth-Token
, but the response shows thatST2_AUTH_TOKEN
is an empty string.