Slightly more future-proof version of the lineinfile fix

pull/18777/head
Toshio Kuratomi 10 years ago committed by Matt Clay
parent 1002fafedf
commit 5204e94bda

@ -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 = """
@ -383,11 +384,7 @@ def main():
line = re.sub(r'(\\[0-9]{1,3})', r'\\\1', line) line = re.sub(r'(\\[0-9]{1,3})', r'\\\1', line)
line = module.safe_eval(line) line = module.safe_eval(line)
# Now remove quotes around the string, if needed after line = codecs.escape_decode(line)
# removing the layer we added above
line = unquote(line)
if should_unquote:
line = unquote(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)
@ -400,5 +397,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…
Cancel
Save