diff --git a/files/lineinfile.py b/files/lineinfile.py index 03bda07cad1..d8b50c13cec 100644 --- a/files/lineinfile.py +++ b/files/lineinfile.py @@ -19,9 +19,10 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . -import pipes import re import os +import pipes +import codecs import tempfile DOCUMENTATION = """ @@ -375,7 +376,7 @@ def main(): if backrefs: 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, ins_aft, ins_bef, create, backup, backrefs) @@ -388,5 +389,5 @@ def main(): # import module snippets from ansible.module_utils.basic import * from ansible.module_utils.splitter import * - -main() +if __name__ == '__main__': + main()