mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Fix file.contains: search for the string rather than requiring an exact match
This commit is contained in:
parent
72b8322395
commit
e26322f567
@ -637,10 +637,11 @@ def contains(path, text):
|
||||
if not os.path.exists(path):
|
||||
return False
|
||||
|
||||
stripped_text = test.strip()
|
||||
try:
|
||||
with BufferedReader(path) as breader:
|
||||
for chunk in breader:
|
||||
if text.strip() == chunk.strip():
|
||||
if stripped_text in chunk:
|
||||
return True
|
||||
return False
|
||||
except (IOError, OSError):
|
||||
|
Loading…
Reference in New Issue
Block a user