Skip to content
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

powershell: do not quote join_path result to reflect ShellBase join_path #45944

Merged
merged 1 commit into from
Sep 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/win_copy-dest-quote.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- win_copy - Fix issue where the dest return value would be enclosed in single quote when dest is a folder - https://github.com/ansible/ansible/issues/45281
2 changes: 1 addition & 1 deletion lib/ansible/plugins/shell/powershell.py
Original file line number Diff line number Diff line change
Expand Up @@ -1503,7 +1503,7 @@ def join_path(self, *args):
path = '\\'.join(parts)
if path.startswith('~'):
return path
return '\'%s\'' % path
return path

def get_remote_filename(self, pathname):
# powershell requires that script files end with .ps1
Expand Down
4 changes: 4 additions & 0 deletions test/integration/targets/win_copy/tasks/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
that:
- copy_file_check is changed
- copy_file_check.checksum == 'c79a6506c1c948be0d456ab5104d5e753ab2f3e6'
- copy_file_check.dest == test_win_copy_path + '\\foo-target.txt'
- copy_file_check.operation == 'file_copy'
- copy_file_check.size == 8
- copy_file_actual_check.stat.exists == False
Expand All @@ -154,6 +155,7 @@
that:
- copy_file is changed
- copy_file.checksum == 'c79a6506c1c948be0d456ab5104d5e753ab2f3e6'
- copy_file.dest == test_win_copy_path + '\\foo-target.txt'
- copy_file.operation == 'file_copy'
- copy_file.size == 8
- copy_file_actual.stat.exists == True
Expand Down Expand Up @@ -187,6 +189,7 @@
that:
- copy_file_to_folder_check is changed
- copy_file_to_folder_check.checksum == 'c79a6506c1c948be0d456ab5104d5e753ab2f3e6'
- copy_file_to_folder_check.dest == test_win_copy_path + '\\foo.txt'
- copy_file_to_folder_check.operation == 'file_copy'
- copy_file_to_folder_check.size == 8
- copy_file_to_folder_actual_check.stat.exists == False
Expand All @@ -207,6 +210,7 @@
that:
- copy_file_to_folder is changed
- copy_file_to_folder.checksum == 'c79a6506c1c948be0d456ab5104d5e753ab2f3e6'
- copy_file_to_folder.dest == test_win_copy_path + '\\foo.txt'
- copy_file_to_folder.operation == 'file_copy'
- copy_file_to_folder.size == 8
- copy_file_to_folder_actual.stat.exists == True
Expand Down