deprecate FileLock (#75032)

Co-authored-by: flowerysong <junk+github@flowerysong.com>
pull/75051/head
Brian Coca 5 years ago committed by GitHub
parent ce17498ec5
commit e8ae7211da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

@ -19,6 +19,7 @@ import sys
from contextlib import contextmanager from contextlib import contextmanager
from ansible.module_utils._text import to_bytes, to_native, to_text 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.six import b, binary_type
from ansible.module_utils.common.warnings import deprecate
try: try:
import selinux import selinux
@ -122,6 +123,8 @@ class FileLock:
unwanted and/or unexpected behaviour unwanted and/or unexpected behaviour
''' '''
def __init__(self): 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 self.lockfd = None
@contextmanager @contextmanager

Loading…
Cancel
Save