deprecate FileLock ()

Co-authored-by: flowerysong <junk+github@flowerysong.com>
This commit is contained in:
Brian Coca 2021-06-17 15:14:41 -04:00 committed by GitHub
parent ce17498ec5
commit e8ae7211da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions
changelogs/fragments
lib/ansible/module_utils/common

View file

@ -0,0 +1,2 @@
deprecated_features:
- module_utils' FileLock is scheduled to be removed, it is not used due to its unreliable nature.

View file

@ -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