mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 04:11:25 -07:00
Refactor _transfer_argsfile to generic string transfer function.
This commit is contained in:
parent
09e690fd7c
commit
edd5baad8b
1 changed files with 3 additions and 3 deletions
|
@ -267,7 +267,7 @@ class Runner(object):
|
||||||
|
|
||||||
# *****************************************************
|
# *****************************************************
|
||||||
|
|
||||||
def _transfer_argsfile(self, conn, tmp, args_str):
|
def _transfer_str(self, conn, tmp, name, args_str):
|
||||||
''' transfer arguments as a single file to be fed to the module. '''
|
''' transfer arguments as a single file to be fed to the module. '''
|
||||||
|
|
||||||
args_fd, args_file = tempfile.mkstemp()
|
args_fd, args_file = tempfile.mkstemp()
|
||||||
|
@ -276,7 +276,7 @@ class Runner(object):
|
||||||
args_fo.flush()
|
args_fo.flush()
|
||||||
args_fo.close()
|
args_fo.close()
|
||||||
|
|
||||||
args_remote = os.path.join(tmp, 'arguments')
|
args_remote = os.path.join(tmp, name)
|
||||||
conn.put_file(args_file, args_remote)
|
conn.put_file(args_file, args_remote)
|
||||||
os.unlink(args_file)
|
os.unlink(args_file)
|
||||||
|
|
||||||
|
@ -355,7 +355,7 @@ class Runner(object):
|
||||||
module_name_tail = remote_module_path.split("/")[-1]
|
module_name_tail = remote_module_path.split("/")[-1]
|
||||||
client_executed_str = "%s %s" % (module_name_tail, args.strip())
|
client_executed_str = "%s %s" % (module_name_tail, args.strip())
|
||||||
|
|
||||||
argsfile = self._transfer_argsfile(conn, tmp, args)
|
argsfile = self._transfer_str(conn, tmp, 'arguments', args)
|
||||||
if async_jid is None:
|
if async_jid is None:
|
||||||
cmd = "%s %s" % (remote_module_path, argsfile)
|
cmd = "%s %s" % (remote_module_path, argsfile)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue