mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
don't shadow builtin
This commit is contained in:
parent
6148c50781
commit
55ea80ee6c
1 changed files with 2 additions and 2 deletions
|
@ -417,12 +417,12 @@ def flopen(*args, **kwargs):
|
|||
Shortcut for fopen with lock and context manager.
|
||||
'''
|
||||
filename = args.pop(0)
|
||||
vars = 'wa'
|
||||
writing = 'wa'
|
||||
with fopen(filename, *args, **kwargs) as f_handle:
|
||||
try:
|
||||
if is_fcntl_available(check_sunos=True):
|
||||
lock_type = fcntl.LOCK_SH
|
||||
if args and any([var in args[0] for var in vars]):
|
||||
if args and any([write in args[0] for write in writing]):
|
||||
lock_type = fcntl.LOCK_EX
|
||||
fcntl.flock(f_handle.fileno(), lock_type)
|
||||
yield f_handle
|
||||
|
|
Loading…
Add table
Reference in a new issue