Fix ST2 Client for Windows Clients#6071
Conversation
|
For the record, what's the error you're getting on Windows systems? |
|
Based on the proposed fix CentOS Linux 8 Ubuntu 20.04.6 LTS Debian GNU/Linux 10 (buster) Rocky Linux 9.2 (Blue Onyx) Ubuntu 18.04.6 LTS Ubuntu 22.04.3 LTS |
|
I suspect you might be hitting this issue with your environment python/cpython#84998. As per the recommendation in the issue, perhaps Tested with other OS's, |
st2client/st2client/base.py
Outdated
| # https://docs.python.org/3.8/library/pwd.html | ||
| # Windows Default ENVVARS -> https://www.computerhope.com/issues/ch000088.htm | ||
| if platform.system() == "Windows": | ||
| os.getlogin = lambda: os.environ.get("USERNAME") |
There was a problem hiding this comment.
As discussed, it's worth checking if the default os.getlogin() works under Windows.
@philipphomberger could you try that?
Something to try before relying on a custom implementation.
If so, we could leave the old workaround conditional for non-windows systems and let Windows rely on native os.getlogin().
arm4b
left a comment
There was a problem hiding this comment.
Looks good,
Thanks for the fix!



We have try to rollout the st2client on the Windows 10/11 clients of our StackStorm users. But because PWD only exist on Unix Based Operation System it failed.