mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #11461 from pilou-/shell_removed
Fix "AttributeError: 'ActionModule' object has no attribute '_shell'"
This commit is contained in:
commit
ad53b6f36a
6 changed files with 15 additions and 15 deletions
|
@ -36,8 +36,8 @@ class ActionModule(ActionBase):
|
|||
tmp = self._make_tmp_path()
|
||||
|
||||
module_name = self._task.action
|
||||
async_module_path = self._shell.join_path(tmp, 'async_wrapper')
|
||||
remote_module_path = self._shell.join_path(tmp, module_name)
|
||||
async_module_path = self._connection._shell.join_path(tmp, 'async_wrapper')
|
||||
remote_module_path = self._connection._shell.join_path(tmp, module_name)
|
||||
|
||||
env_string = self._compute_environment_string()
|
||||
|
||||
|
@ -51,7 +51,7 @@ class ActionModule(ActionBase):
|
|||
self._transfer_data(async_module_path, async_module_data)
|
||||
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_jid = str(random.randint(0, 999999999999))
|
||||
|
|
|
@ -115,8 +115,8 @@ class ActionModule(ActionBase):
|
|||
|
||||
# If it's recursive copy, destination is always a dir,
|
||||
# explicitly mark it so (note - copy module relies on this).
|
||||
if not self._shell.path_has_trailing_slash(dest):
|
||||
dest = self._shell.join_path(dest, '')
|
||||
if not self._connection._shell.path_has_trailing_slash(dest):
|
||||
dest = self._connection._shell.join_path(dest, '')
|
||||
else:
|
||||
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
|
||||
# dir, do path manipulation right away, otherwise we still check
|
||||
# for dest being a dir via remote call below.
|
||||
if self._shell.path_has_trailing_slash(dest):
|
||||
dest_file = self._shell.join_path(dest, source_rel)
|
||||
if self._connection._shell.path_has_trailing_slash(dest):
|
||||
dest_file = self._connection._shell.join_path(dest, source_rel)
|
||||
else:
|
||||
dest_file = self._shell.join_path(dest)
|
||||
dest_file = self._connection._shell.join_path(dest)
|
||||
|
||||
# Attempt to get the remote checksum
|
||||
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")
|
||||
else:
|
||||
# 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)
|
||||
|
||||
if remote_checksum != '1' and not force:
|
||||
|
|
|
@ -52,7 +52,7 @@ class ActionModule(ActionBase):
|
|||
if source is None or dest is None:
|
||||
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)
|
||||
|
||||
# calculate checksum for the remote file
|
||||
|
@ -78,7 +78,7 @@ class ActionModule(ActionBase):
|
|||
pass
|
||||
|
||||
# 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('\\', '/')
|
||||
else:
|
||||
source_local = source
|
||||
|
|
|
@ -47,7 +47,7 @@ class ActionModule(ActionBase):
|
|||
if tmp is None or "-tmp-" not in tmp:
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
# 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)
|
||||
|
||||
sudoable = True
|
||||
|
|
|
@ -122,7 +122,7 @@ class ActionModule(ActionBase):
|
|||
# else:
|
||||
# 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
|
||||
if self._connection_info.become and self._connection_info.become_user != 'root':
|
||||
|
|
Loading…
Reference in a new issue