-
Notifications
You must be signed in to change notification settings - Fork 325
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
(maint) quote file path in file_contents_on
and file_exists_on
#1647
(maint) quote file path in file_contents_on
and file_exists_on
#1647
Conversation
@@ -497,7 +497,7 @@ def file_exists_on(host, file_path) | |||
if file_path.include?(':') | |||
split_path = win_ads_path(file_path) | |||
|
|||
command = %(Test-Path #{split_path[:path]}) | |||
command = %(Test-Path "#{split_path[:path]}") |
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.
Is this to support paths with spaces in them?
I think you would need it here too and on line 495 above for the case where there is no ads path?
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.
It is to protect windows path (c:\asdasd) from cygwin shell expansion. Without it C:\Windows\TEMP\install-puppet-2020-05-15_15.38.14.log
gets modified to C:\cygwin64\home\Administrator\WindowsTEMPinstall-puppet-2020-05-15_15.38.14.log
@@ -555,7 +555,7 @@ def file_contents_on(host, file_path) | |||
if host['platform'] =~ /windows/ | |||
file_path.gsub!('/', '\\') |
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.
that substitution is not done in file_exists_on
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.
It looks to work without, should I still add it there?
@@ -555,7 +555,7 @@ def file_contents_on(host, file_path) | |||
if host['platform'] =~ /windows/ | |||
file_path.gsub!('/', '\\') | |||
|
|||
command = %{Get-Content -Raw -Path #{file_path}} | |||
command = %{Get-Content -Raw -Path "#{file_path}"} | |||
command += %{ -Stream #{split_path[:ads]}} if split_path[:ads] |
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.
would you need it here too?
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.
Yes, this change is surely needed
To give more background, puppet-code acceptance failed with bellow error. It looks that if the "c:\" path is passed as parameter from directly from cygwin to powershell without " it gets messed up. I updated in this PR the two cases hit by my tests (while I still think
|
7fadd8f
to
87dad4d
Compare
This looks very similar to #1626 (comment) are you using a beaker-puppet with this change puppetlabs/beaker-puppet#135 |
Co-authored-by: Samuel <[email protected]>
@donoghuc , I will recheck as the PR you mention was not merged/released at that time. |
Problem is already solved in beaker 4.23.1 |
No description provided.