summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Krizek <martin.krizek@gmail.com>2023-04-27 13:46:13 +0200
committerGitHub <noreply@github.com>2023-04-27 13:46:13 +0200
commit8754d8e1e1ea7a2b931d028ce0fc45084254fa5b (patch)
tree2d75e869eb3d1c4967cdc096198bbce06cd8a801
parentcc5f8c529b95e6368d46ca7b0e533a044124f69b (diff)
downloadansible-8754d8e1e1ea7a2b931d028ce0fc45084254fa5b.tar.gz
ActionBase: remove deprecated _remote_checksum (#80440)
-rw-r--r--changelogs/fragments/remove-deprecated-actionbase-_remote_checksum.yml2
-rw-r--r--lib/ansible/plugins/action/__init__.py32
-rw-r--r--test/sanity/ignore.txt1
3 files changed, 2 insertions, 33 deletions
diff --git a/changelogs/fragments/remove-deprecated-actionbase-_remote_checksum.yml b/changelogs/fragments/remove-deprecated-actionbase-_remote_checksum.yml
new file mode 100644
index 0000000000..7d38a216b9
--- /dev/null
+++ b/changelogs/fragments/remove-deprecated-actionbase-_remote_checksum.yml
@@ -0,0 +1,2 @@
+removed_features:
+ - ActionBase - remove deprecated ``_remote_checksum`` method
diff --git a/lib/ansible/plugins/action/__init__.py b/lib/ansible/plugins/action/__init__.py
index 39c6722152..a2d14e3320 100644
--- a/lib/ansible/plugins/action/__init__.py
+++ b/lib/ansible/plugins/action/__init__.py
@@ -874,38 +874,6 @@ class ActionBase(ABC):
return mystat['stat']
- def _remote_checksum(self, path, all_vars, follow=False):
- """Deprecated. Use _execute_remote_stat() instead.
-
- Produces a remote checksum given a path,
- Returns a number 0-4 for specific errors instead of checksum, also ensures it is different
- 0 = unknown error
- 1 = file does not exist, this might not be an error
- 2 = permissions issue
- 3 = its a directory, not a file
- 4 = stat module failed, likely due to not finding python
- 5 = appropriate json module not found
- """
- self._display.deprecated("The '_remote_checksum()' method is deprecated. "
- "The plugin author should update the code to use '_execute_remote_stat()' instead", "2.16")
- x = "0" # unknown error has occurred
- try:
- remote_stat = self._execute_remote_stat(path, all_vars, follow=follow)
- if remote_stat['exists'] and remote_stat['isdir']:
- x = "3" # its a directory not a file
- else:
- x = remote_stat['checksum'] # if 1, file is missing
- except AnsibleError as e:
- errormsg = to_text(e)
- if errormsg.endswith(u'Permission denied'):
- x = "2" # cannot read file
- elif errormsg.endswith(u'MODULE FAILURE'):
- x = "4" # python not found or module uncaught exception
- elif 'json' in errormsg:
- x = "5" # json module needed
- finally:
- return x # pylint: disable=lost-exception
-
def _remote_expand_user(self, path, sudoable=True, pathsep=None):
''' takes a remote path and performs tilde/$HOME expansion on the remote host '''
diff --git a/test/sanity/ignore.txt b/test/sanity/ignore.txt
index d7c4f7530f..9bd2379616 100644
--- a/test/sanity/ignore.txt
+++ b/test/sanity/ignore.txt
@@ -244,5 +244,4 @@ test/units/utils/collection_loader/fixtures/collections_masked/ansible_collectio
test/units/utils/collection_loader/test_collection_loader.py pylint:undefined-variable # magic runtime local var splatting
lib/ansible/playbook/helpers.py pylint:ansible-deprecated-version
lib/ansible/playbook/included_file.py pylint:ansible-deprecated-version
-lib/ansible/plugins/action/__init__.py pylint:ansible-deprecated-version
lib/ansible/module_utils/common/file.py pylint:ansible-deprecated-version