Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
2e4c02f9
Commit
2e4c02f9
authored
Mar 22, 2013
by
Piotr Kweclich
Committed by
Piotr Kweclich
Mar 22, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
disabled appending file with garbage when regexp didn't match.
parent
50461a68
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletions
+5
-1
library/lineinfile
+5
-1
No files found.
library/lineinfile
View file @
2e4c02f9
...
@@ -184,10 +184,14 @@ def present(module, dest, regexp, line, insertafter, insertbefore, create, backu
...
@@ -184,10 +184,14 @@ def present(module, dest, regexp, line, insertafter, insertbefore, create, backu
# Add it to the end of the file if requested or
# Add it to the end of the file if requested or
# if insertafter=/insertbefore didn't match anything
# if insertafter=/insertbefore didn't match anything
# (so default behaviour is to add at the end)
# (so default behaviour is to add at the end)
elif
insertafter
==
'EOF'
or
index
[
1
]
==
-
1
:
elif
insertafter
==
'EOF'
:
lines
.
append
(
line
+
os
.
linesep
)
lines
.
append
(
line
+
os
.
linesep
)
msg
=
'line added'
msg
=
'line added'
changed
=
True
changed
=
True
# Do nothing if regexp didn't match
elif
index
[
1
]
==
-
1
:
msg
=
''
changed
=
False
# insertafter/insertbefore= matched
# insertafter/insertbefore= matched
else
:
else
:
lines
.
insert
(
index
[
1
],
line
+
os
.
linesep
)
lines
.
insert
(
index
[
1
],
line
+
os
.
linesep
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment