mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-30 12:10:22 -07:00
Move a path being passed around as a byte string to being passed around as a text string. (#17190)
This is enough to get minimal copy module working on python3 We have t omodify dataloader's path_dwim_relative_stack and everything that calls it to use text paths instead of byte string paths
This commit is contained in:
parent
20bde8f549
commit
313d4b2c9e
12 changed files with 94 additions and 58 deletions
|
@ -27,7 +27,7 @@ from ansible.errors import AnsibleError
|
|||
from ansible.plugins.action import ActionBase
|
||||
from ansible.utils.boolean import boolean
|
||||
from ansible.utils.hashing import checksum
|
||||
from ansible.utils.unicode import to_bytes, to_str
|
||||
from ansible.utils.unicode import to_bytes, to_str, to_unicode
|
||||
|
||||
|
||||
class ActionModule(ActionBase):
|
||||
|
@ -96,7 +96,7 @@ class ActionModule(ActionBase):
|
|||
source = self._find_needle('files', source)
|
||||
except AnsibleError as e:
|
||||
result['failed'] = True
|
||||
result['msg'] = to_str(e)
|
||||
result['msg'] = to_unicode(e)
|
||||
return result
|
||||
|
||||
# A list of source file tuples (full_path, relative_path) which will try to copy to the destination
|
||||
|
@ -111,7 +111,7 @@ class ActionModule(ActionBase):
|
|||
sz = len(source.rsplit('/', 1)[0]) + 1
|
||||
|
||||
# Walk the directory and append the file tuples to source_files.
|
||||
for base_path, sub_folders, files in os.walk(source):
|
||||
for base_path, sub_folders, files in os.walk(to_bytes(source)):
|
||||
for file in files:
|
||||
full_path = os.path.join(base_path, file)
|
||||
rel_path = full_path[sz:]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue