Commit a9db27d4 authored by David Wilson's avatar David Wilson

ansible: instrument every ActionMixin override.

parent 500c4f41
...@@ -172,6 +172,7 @@ class ActionModuleMixin(ansible.plugins.action.ActionBase): ...@@ -172,6 +172,7 @@ class ActionModuleMixin(ansible.plugins.action.ActionBase):
Determine if `path` exists by directly invoking os.path.exists() in the Determine if `path` exists by directly invoking os.path.exists() in the
target user account. target user account.
""" """
LOG.debug('_remote_file_exists(%r)', path)
return self.call(os.path.exists, path) return self.call(os.path.exists, path)
def _configure_module(self, module_name, module_args, task_vars=None): def _configure_module(self, module_name, module_args, task_vars=None):
...@@ -193,6 +194,7 @@ class ActionModuleMixin(ansible.plugins.action.ActionBase): ...@@ -193,6 +194,7 @@ class ActionModuleMixin(ansible.plugins.action.ActionBase):
Replace the base implementation's use of shell to implement mkdtemp() Replace the base implementation's use of shell to implement mkdtemp()
with an actual call to mkdtemp(). with an actual call to mkdtemp().
""" """
LOG.debug('_make_tmp_path(remote_user=%r)', remote_user)
path = self.call(tempfile.mkdtemp, prefix='ansible-mitogen-tmp-') path = self.call(tempfile.mkdtemp, prefix='ansible-mitogen-tmp-')
self._cleanup_remote_tmp = True self._cleanup_remote_tmp = True
return path return path
...@@ -202,6 +204,7 @@ class ActionModuleMixin(ansible.plugins.action.ActionBase): ...@@ -202,6 +204,7 @@ class ActionModuleMixin(ansible.plugins.action.ActionBase):
Replace the base implementation's invocation of rm -rf with a call to Replace the base implementation's invocation of rm -rf with a call to
shutil.rmtree(). shutil.rmtree().
""" """
LOG.debug('_remove_tmp_path(%r)', tmp_path)
if self._should_remove_tmp_path(tmp_path): if self._should_remove_tmp_path(tmp_path):
return self.call(shutil.rmtree, tmp_path) return self.call(shutil.rmtree, tmp_path)
...@@ -210,6 +213,8 @@ class ActionModuleMixin(ansible.plugins.action.ActionBase): ...@@ -210,6 +213,8 @@ class ActionModuleMixin(ansible.plugins.action.ActionBase):
Used by the base _execute_module(), and in <2.4 also by the template Used by the base _execute_module(), and in <2.4 also by the template
action module, and probably others. action module, and probably others.
""" """
LOG.debug('_transfer_data(%r, %s ..%d bytes)',
remote_path, type(data), len(data))
self._connection.put_data(remote_path, data) self._connection.put_data(remote_path, data)
def _fixup_perms2(self, remote_paths, remote_user=None, execute=True): def _fixup_perms2(self, remote_paths, remote_user=None, execute=True):
...@@ -218,6 +223,8 @@ class ActionModuleMixin(ansible.plugins.action.ActionBase): ...@@ -218,6 +223,8 @@ class ActionModuleMixin(ansible.plugins.action.ActionBase):
target user account, so it is never necessary to modify permissions target user account, so it is never necessary to modify permissions
except to ensure the execute bit is set if requested. except to ensure the execute bit is set if requested.
""" """
LOG.debug('_fixup_perms2(%r, remote_user=%r, execute=%r)',
remote_paths, remote_user, execute)
if execute: if execute:
return self._remote_chmod(remote_paths, mode='u+x') return self._remote_chmod(remote_paths, mode='u+x')
return self.COMMAND_RESULT.copy() return self.COMMAND_RESULT.copy()
...@@ -227,6 +234,8 @@ class ActionModuleMixin(ansible.plugins.action.ActionBase): ...@@ -227,6 +234,8 @@ class ActionModuleMixin(ansible.plugins.action.ActionBase):
Issue an asynchronous set_file_mode() call for every path in `paths`, Issue an asynchronous set_file_mode() call for every path in `paths`,
then format the resulting return value list with fake_shell(). then format the resulting return value list with fake_shell().
""" """
LOG.debug('_remote_chmod(%r, mode=%r, sudoable=%r)',
paths, mode, sudoable)
return self.fake_shell(lambda: mitogen.master.Select.all( return self.fake_shell(lambda: mitogen.master.Select.all(
self._connection.call_async( self._connection.call_async(
ansible_mitogen.helpers.set_file_mode, path, mode ansible_mitogen.helpers.set_file_mode, path, mode
...@@ -239,6 +248,8 @@ class ActionModuleMixin(ansible.plugins.action.ActionBase): ...@@ -239,6 +248,8 @@ class ActionModuleMixin(ansible.plugins.action.ActionBase):
Issue an asynchronous os.chown() call for every path in `paths`, then Issue an asynchronous os.chown() call for every path in `paths`, then
format the resulting return value list with fake_shell(). format the resulting return value list with fake_shell().
""" """
LOG.debug('_remote_chown(%r, user=%r, sudoable=%r)',
paths, user, sudoable)
ent = self.call(pwd.getpwnam, user) ent = self.call(pwd.getpwnam, user)
return self.fake_shell(lambda: mitogen.master.Select.all( return self.fake_shell(lambda: mitogen.master.Select.all(
self._connection.call_async( self._connection.call_async(
...@@ -252,6 +263,7 @@ class ActionModuleMixin(ansible.plugins.action.ActionBase): ...@@ -252,6 +263,7 @@ class ActionModuleMixin(ansible.plugins.action.ActionBase):
Replace the base implementation's attempt to emulate Replace the base implementation's attempt to emulate
os.path.expanduser() with an actual call to os.path.expanduser(). os.path.expanduser() with an actual call to os.path.expanduser().
""" """
LOG.debug('_remove_expand_user(%r, sudoable=%r)', path, sudoable)
if path.startswith('~'): if path.startswith('~'):
path = self.call(os.path.expanduser, path) path = self.call(os.path.expanduser, path)
return path return path
...@@ -310,6 +322,8 @@ class ActionModuleMixin(ansible.plugins.action.ActionBase): ...@@ -310,6 +322,8 @@ class ActionModuleMixin(ansible.plugins.action.ActionBase):
Replace the mad rat's nest of logic in the base implementation by Replace the mad rat's nest of logic in the base implementation by
simply calling helpers.exec_command() in the target context. simply calling helpers.exec_command() in the target context.
""" """
LOG.debug('_low_level_execute_command(%r, in_data=%r, exe=%r, dir=%r)',
cmd, type(in_data), executable, chdir)
if executable is None: # executable defaults to False if executable is None: # executable defaults to False
executable = self._play_context.executable executable = self._play_context.executable
if executable: if executable:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment