summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2022-10-11 15:09:02 +0200
committerGuilhem Moulin <guilhem@fripost.org>2022-10-11 15:09:02 +0200
commit43a7f11e34a5c1a546a7bd547a9c5a6379cfa2e3 (patch)
tree591876aabfe248ba72cf0e5dc47af82f8b47e639
parente9bf1e364b16a230aa7ec6b66c47bce7f68f3cd9 (diff)
fetch_cmd: Replace deprecated ‘_remote_checksum()’ with ‘_execute_remote_stat()’.
This silences the following deprecation warning: The '_remote_checksum()' method is deprecated. The plugin author should update the code to use '_execute_remote_stat()' instead. This feature will be removed in version 2.16. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
-rw-r--r--lib/action_plugins/fetch_cmd.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/action_plugins/fetch_cmd.py b/lib/action_plugins/fetch_cmd.py
index 57d7220..93960eb 100644
--- a/lib/action_plugins/fetch_cmd.py
+++ b/lib/action_plugins/fetch_cmd.py
@@ -33,30 +33,30 @@ class ActionModule(ActionBase):
cmd = self._task.args.get('cmd', None)
stdin = self._task.args.get('stdin', None)
dest = self._task.args.get('dest', None)
if cmd is None or dest is None:
return dict(failed=True, msg="cmd and dest are required")
if stdin is not None:
stdin = self._connection._shell.join_path(stdin)
stdin = self._remote_expand_user(stdin)
remote_user = task_vars.get('ansible_ssh_user') or self._play_context.remote_user
stdout = self._connection._shell.join_path(self._make_tmp_path(remote_user), 'stdout')
result.update(self._execute_module(module_args=dict(cmd=cmd, stdin=stdin, dest=stdout), task_vars=task_vars))
# calculate checksum for the local file
local_checksum = checksum(dest)
# calculate checksum for the remote file, don't bother if using become as slurp will be used
- remote_checksum = self._remote_checksum(stdout, all_vars=task_vars)
+ remote_checksum = self._execute_remote_stat(stdout, all_vars=task_vars, follow=True).get('checksum')
if remote_checksum != local_checksum:
makedirs_safe(os.path.dirname(dest))
self._connection.fetch_file(stdout, dest)
if checksum(dest) == remote_checksum:
result.update(dict(changed=True))
else:
result.update(dict(failed=True))
return result