-
Notifications
You must be signed in to change notification settings - Fork 1.9k
lineinfile not insertafter 'EOF' if line presents in file #2054
Comments
@ansible ping, this issue is waiting for your response. |
@ansible, ping. This issue is still waiting on your response. |
@ansible, ping. This issue is still waiting on your response. |
2 similar comments
@ansible, ping. This issue is still waiting on your response. |
@ansible, ping. This issue is still waiting on your response. |
@ansible, ping. This issue is still waiting on your response. |
This repository has been locked. All new issues and pull requests should be filed in https://github.com/ansible/ansible Please read through the repomerge page in the dev guide. The guide contains links to tools which automatically move your issue or pull request to the ansible/ansible repo. |
This issue was migrated to ansible/ansible#30046 |
Issue Type: Bug Report
Ansible Version: 1.9.3
Ansible Configuration: default
Environment: Ubuntu 14.04
Summary:
lineinfile
won't insert line after EOF if line has presented in file.Steps To Reproduce:
An example ansible task:
My /tmp/test.txt:
Expected Results:
Actual Results:
And /tmp/test.txt not changed.
In lineinfile.py,
https://github.com/ansible/ansible-modules-core/blob/devel/files/lineinfile.py#L233
The condition
if index[0] != -1:
checked regexp matched a line in file, but it did not check regexp is defined or not.I changed this line into
if index[0] != -1 and regexp is not None:
and re-executed the playbook. It worked as expected.The text was updated successfully, but these errors were encountered: