Closed lakshmi-kannan closed 8 years ago
To clarify some things (things also need to be clarified in the docs):
By default, st2actionrunner should also run under system_user (stanley
) and as such, the result should be the same, unless user wants to run a local runner action under a different user or use sudo to run it as a root.
In this case, we will use sudo
and the result will depend on the sudo settings (e.g. should environment variables be preserved or not).
Edit: Actually, I just had a look - we use sudo -E
, but user still needs to put setenv
option in the sudoers file otherwise environment won't be preserved and -E wont have an affect.
To clarify my comment and question on IRC - that's how it works right now as long as you correctly run st2actionrunner under stanley (system) user.
If you want to use a custom (non stanley / system) user, you need give him paswordless sudo access if you want to run local runner actions as a different user and as a root. In addition to that, you also need to make sure SETENV
sudoers option is set for that user - otherwise environment variables would be preserved when running action as a different / root user.
@skarmark Please let me know if my comment above and documentation updates make it more clear and resolve this issue.
@skarmark ping! can you answer kami's question?
Yes, it is clear. Sorry about the delay! Somehow missed the update on this thread.
Thanks for letting us know.
Closing this issue.
Shell actions like core.local and core.remote run as system_user whereas python actions run as user as which st2 processes run. So setting environment variables needs to happen for different users for different actions. We need a less confusing way. Perhaps some documentation around this.
Reported by: @skarmark on freenode.