mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix "AttributeError: 'ActionModule' object has no attribute '_shell'"
'_shell' was removed with commit 2a5fbd8570
This commit is contained in:
parent
a155f65a89
commit
4d4512940d
6 changed files with 15 additions and 15 deletions
|
@ -36,8 +36,8 @@ class ActionModule(ActionBase):
|
||||||
tmp = self._make_tmp_path()
|
tmp = self._make_tmp_path()
|
||||||
|
|
||||||
module_name = self._task.action
|
module_name = self._task.action
|
||||||
async_module_path = self._shell.join_path(tmp, 'async_wrapper')
|
async_module_path = self._connection._shell.join_path(tmp, 'async_wrapper')
|
||||||
remote_module_path = self._shell.join_path(tmp, module_name)
|
remote_module_path = self._connection._shell.join_path(tmp, module_name)
|
||||||
|
|
||||||
env_string = self._compute_environment_string()
|
env_string = self._compute_environment_string()
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ class ActionModule(ActionBase):
|
||||||
self._transfer_data(async_module_path, async_module_data)
|
self._transfer_data(async_module_path, async_module_data)
|
||||||
self._remote_chmod(tmp, 'a+rx', async_module_path)
|
self._remote_chmod(tmp, 'a+rx', async_module_path)
|
||||||
|
|
||||||
argsfile = self._transfer_data(self._shell.join_path(tmp, 'arguments'), json.dumps(self._task.args))
|
argsfile = self._transfer_data(self._connection._shell.join_path(tmp, 'arguments'), json.dumps(self._task.args))
|
||||||
|
|
||||||
async_limit = self._task.async
|
async_limit = self._task.async
|
||||||
async_jid = str(random.randint(0, 999999999999))
|
async_jid = str(random.randint(0, 999999999999))
|
||||||
|
|
|
@ -115,8 +115,8 @@ class ActionModule(ActionBase):
|
||||||
|
|
||||||
# If it's recursive copy, destination is always a dir,
|
# If it's recursive copy, destination is always a dir,
|
||||||
# explicitly mark it so (note - copy module relies on this).
|
# explicitly mark it so (note - copy module relies on this).
|
||||||
if not self._shell.path_has_trailing_slash(dest):
|
if not self._connection._shell.path_has_trailing_slash(dest):
|
||||||
dest = self._shell.join_path(dest, '')
|
dest = self._connection._shell.join_path(dest, '')
|
||||||
else:
|
else:
|
||||||
source_files.append((source, os.path.basename(source)))
|
source_files.append((source, os.path.basename(source)))
|
||||||
|
|
||||||
|
@ -151,10 +151,10 @@ class ActionModule(ActionBase):
|
||||||
# This is kind of optimization - if user told us destination is
|
# This is kind of optimization - if user told us destination is
|
||||||
# dir, do path manipulation right away, otherwise we still check
|
# dir, do path manipulation right away, otherwise we still check
|
||||||
# for dest being a dir via remote call below.
|
# for dest being a dir via remote call below.
|
||||||
if self._shell.path_has_trailing_slash(dest):
|
if self._connection._shell.path_has_trailing_slash(dest):
|
||||||
dest_file = self._shell.join_path(dest, source_rel)
|
dest_file = self._connection._shell.join_path(dest, source_rel)
|
||||||
else:
|
else:
|
||||||
dest_file = self._shell.join_path(dest)
|
dest_file = self._connection._shell.join_path(dest)
|
||||||
|
|
||||||
# Attempt to get the remote checksum
|
# Attempt to get the remote checksum
|
||||||
remote_checksum = self._remote_checksum(tmp, dest_file)
|
remote_checksum = self._remote_checksum(tmp, dest_file)
|
||||||
|
@ -167,7 +167,7 @@ class ActionModule(ActionBase):
|
||||||
return dict(failed=True, msg="can not use content with a dir as dest")
|
return dict(failed=True, msg="can not use content with a dir as dest")
|
||||||
else:
|
else:
|
||||||
# Append the relative source location to the destination and retry remote_checksum
|
# Append the relative source location to the destination and retry remote_checksum
|
||||||
dest_file = self._shell.join_path(dest, source_rel)
|
dest_file = self._connection._shell.join_path(dest, source_rel)
|
||||||
remote_checksum = self._remote_checksum(tmp, dest_file)
|
remote_checksum = self._remote_checksum(tmp, dest_file)
|
||||||
|
|
||||||
if remote_checksum != '1' and not force:
|
if remote_checksum != '1' and not force:
|
||||||
|
|
|
@ -52,7 +52,7 @@ class ActionModule(ActionBase):
|
||||||
if source is None or dest is None:
|
if source is None or dest is None:
|
||||||
return dict(failed=True, msg="src and dest are required")
|
return dict(failed=True, msg="src and dest are required")
|
||||||
|
|
||||||
source = self._shell.join_path(source)
|
source = self._connection._shell.join_path(source)
|
||||||
source = self._remote_expand_user(source, tmp)
|
source = self._remote_expand_user(source, tmp)
|
||||||
|
|
||||||
# calculate checksum for the remote file
|
# calculate checksum for the remote file
|
||||||
|
@ -78,7 +78,7 @@ class ActionModule(ActionBase):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# calculate the destination name
|
# calculate the destination name
|
||||||
if os.path.sep not in self._shell.join_path('a', ''):
|
if os.path.sep not in self._connection._shell.join_path('a', ''):
|
||||||
source_local = source.replace('\\', '/')
|
source_local = source.replace('\\', '/')
|
||||||
else:
|
else:
|
||||||
source_local = source
|
source_local = source
|
||||||
|
|
|
@ -47,7 +47,7 @@ class ActionModule(ActionBase):
|
||||||
if tmp is None or "-tmp-" not in tmp:
|
if tmp is None or "-tmp-" not in tmp:
|
||||||
tmp = self._make_tmp_path()
|
tmp = self._make_tmp_path()
|
||||||
|
|
||||||
tmp_src = self._shell.join_path(tmp, os.path.basename(src))
|
tmp_src = self._connection._shell.join_path(tmp, os.path.basename(src))
|
||||||
self._connection.put_file(src, tmp_src)
|
self._connection.put_file(src, tmp_src)
|
||||||
|
|
||||||
if self._connection_info.become and self._connection_info.become_user != 'root':
|
if self._connection_info.become and self._connection_info.become_user != 'root':
|
||||||
|
|
|
@ -71,7 +71,7 @@ class ActionModule(ActionBase):
|
||||||
source = self._loader.path_dwim(source)
|
source = self._loader.path_dwim(source)
|
||||||
|
|
||||||
# transfer the file to a remote tmp location
|
# transfer the file to a remote tmp location
|
||||||
tmp_src = self._shell.join_path(tmp, os.path.basename(source))
|
tmp_src = self._connection._shell.join_path(tmp, os.path.basename(source))
|
||||||
self._connection.put_file(source, tmp_src)
|
self._connection.put_file(source, tmp_src)
|
||||||
|
|
||||||
sudoable = True
|
sudoable = True
|
||||||
|
|
|
@ -121,8 +121,8 @@ class ActionModule(ActionBase):
|
||||||
# dest_contents = base64.b64decode(dest_contents)
|
# dest_contents = base64.b64decode(dest_contents)
|
||||||
# else:
|
# else:
|
||||||
# raise Exception("unknown encoding, failed: %s" % dest_result.result)
|
# raise Exception("unknown encoding, failed: %s" % dest_result.result)
|
||||||
|
|
||||||
xfered = self._transfer_data(self._shell.join_path(tmp, 'source'), resultant)
|
xfered = self._transfer_data(self._connection._shell.join_path(tmp, 'source'), resultant)
|
||||||
|
|
||||||
# fix file permissions when the copy is done as a different user
|
# fix file permissions when the copy is done as a different user
|
||||||
if self._connection_info.become and self._connection_info.become_user != 'root':
|
if self._connection_info.become and self._connection_info.become_user != 'root':
|
||||||
|
|
Loading…
Reference in a new issue