New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixed issue with using only $env:temp as temp path on windows #25795
fixed issue with using only $env:temp as temp path on windows #25795
Conversation
* The argument `tmpdir` is not using in `mkdtemp` function. Every time when ansible is creating temporary folder on remote machine (which is using Windows as OS) the path has been set to value of $env:temp (and ignoring the value of `remote_tmp` from ansible.cfg)
The test
The test
The test
The test
The test
|
if tmpdir is None: | ||
tmpdir = "$env:temp" | ||
|
||
return self._encode_script('''(New-Item -Type Directory -Path %s -Name "%s").FullName | Write-Host -Separator '';''' % (tmpdir, basefile)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if tmpdir consists of a path with spaces in it ?
I expect Powershell to fail on this, an it should be quoted ...Directory -Path "%s" -Name...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that's correct (the value should be double-quoted).
I'm OK with this in general, but IMO this feature needs to be gated on making |
Sounds like @bcoca may already have done some work on the inventory-settable |
Looks related to #31022 |
Beware that the deadline for getting new features/modules accepted in Ansible v2.5 is nearing, it is set to either 2018-01-15 or 2018-01-31. If you are blocked, or you need feedback, please discuss on IRC channel #ansible-windows or add a comment to the Windows Working Group meeting agenda to get it resolved. |
@mmasztalerczuk thanks for the PR, this fix was eventually added in #34967 once the shell config options were added in another PR. |
SUMMARY
tmpdir
is not using inmkdtemp
function.Every time when ansible is creating temporary folder on remote
machine (which is using Windows as OS) the path has been set
to value of $env:temp (and ignoring the value of
remote_tmp
from ansible.cfg)
ISSUE TYPE
COMPONENT NAME
plugins/shell/powershell.py