mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +00:00
Line in file regexep should match a portion of the line, not the whole line!
This commit is contained in:
@@ -27,8 +27,8 @@ def present(module, name, regexp, line, insertafter, backup):
|
|||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
mre = re.compile(regexp)
|
mre = re.compile(regexp)
|
||||||
if not mre.match(line):
|
if not mre.search(line):
|
||||||
module.fail_json(msg="line= doesn't match regexp=")
|
module.fail_json(msg="usage error: line= doesn't match regexp (%s)" % regexp)
|
||||||
|
|
||||||
if insertafter in ('BOF', 'EOF'):
|
if insertafter in ('BOF', 'EOF'):
|
||||||
iare = None
|
iare = None
|
||||||
|
|||||||
Reference in New Issue
Block a user