diff --git a/changelogs/fragments/filelock_bye.yml b/changelogs/fragments/filelock_bye.yml new file mode 100644 index 00000000000..69f923284ef --- /dev/null +++ b/changelogs/fragments/filelock_bye.yml @@ -0,0 +1,2 @@ +deprecated_features: + - module_utils' FileLock is scheduled to be removed, it is not used due to its unreliable nature. diff --git a/lib/ansible/module_utils/common/file.py b/lib/ansible/module_utils/common/file.py index 9703ea782eb..93e26b98610 100644 --- a/lib/ansible/module_utils/common/file.py +++ b/lib/ansible/module_utils/common/file.py @@ -19,6 +19,7 @@ import sys from contextlib import contextmanager from ansible.module_utils._text import to_bytes, to_native, to_text from ansible.module_utils.six import b, binary_type +from ansible.module_utils.common.warnings import deprecate try: import selinux @@ -122,6 +123,8 @@ class FileLock: unwanted and/or unexpected behaviour ''' def __init__(self): + deprecate("FileLock is not reliable and has never been used in core for that reason. There is no current alternative that works across POSIX targets", + version='2.16') self.lockfd = None @contextmanager