Slightly more future-proof version of the lineinfile fix
This commit is contained in:
parent
2eafbdd63a
commit
142760658f
1 changed files with 5 additions and 4 deletions
|
@ -19,9 +19,10 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import pipes
|
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
|
import pipes
|
||||||
|
import codecs
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
DOCUMENTATION = """
|
DOCUMENTATION = """
|
||||||
|
@ -375,7 +376,7 @@ def main():
|
||||||
if backrefs:
|
if backrefs:
|
||||||
line = re.sub(r'(\\[0-9]{1,3})', r'\\\1', line)
|
line = re.sub(r'(\\[0-9]{1,3})', r'\\\1', line)
|
||||||
|
|
||||||
line = line.decode("string_escape")
|
line = codecs.escape_decode(line)
|
||||||
|
|
||||||
present(module, dest, params['regexp'], line,
|
present(module, dest, params['regexp'], line,
|
||||||
ins_aft, ins_bef, create, backup, backrefs)
|
ins_aft, ins_bef, create, backup, backrefs)
|
||||||
|
@ -388,5 +389,5 @@ def main():
|
||||||
# import module snippets
|
# import module snippets
|
||||||
from ansible.module_utils.basic import *
|
from ansible.module_utils.basic import *
|
||||||
from ansible.module_utils.splitter import *
|
from ansible.module_utils.splitter import *
|
||||||
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in a new issue