|
|
@ -735,12 +735,14 @@ class ActionBase(with_metaclass(ABCMeta, object)):
|
|
|
|
|
|
|
|
|
|
|
|
display.debug("_low_level_execute_command(): executing: %s" % (cmd,))
|
|
|
|
display.debug("_low_level_execute_command(): executing: %s" % (cmd,))
|
|
|
|
|
|
|
|
|
|
|
|
# Change directory to basedir of task for command execution
|
|
|
|
# Change directory to basedir of task for command execution when connection is local
|
|
|
|
cwd = os.getcwd()
|
|
|
|
if self._connection.transport == 'local':
|
|
|
|
os.chdir(self._loader.get_basedir())
|
|
|
|
os.chdir(self._loader.get_basedir())
|
|
|
|
|
|
|
|
cwd = os.getcwd()
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
rc, stdout, stderr = self._connection.exec_command(cmd, in_data=in_data, sudoable=sudoable)
|
|
|
|
rc, stdout, stderr = self._connection.exec_command(cmd, in_data=in_data, sudoable=sudoable)
|
|
|
|
finally:
|
|
|
|
finally:
|
|
|
|
|
|
|
|
if self._connection.transport == 'local':
|
|
|
|
os.chdir(cwd)
|
|
|
|
os.chdir(cwd)
|
|
|
|
|
|
|
|
|
|
|
|
# stdout and stderr may be either a file-like or a bytes object.
|
|
|
|
# stdout and stderr may be either a file-like or a bytes object.
|
|
|
|