Question about stack trace

Any idea what these errors would mean ?

The remote machine is a centos 6.

Line is:

  • name: Set Environment Variables in bashrc
    lineinfile: dest=.bashrc regexp=“^export TOOLSREPO=~/kk-tools” line=“export TOOLSREPO=~/kk-tools” state=present create=yes
    register: update_bashrc
    when_string: $ansible_pkg_mgr == ‘yum’

Stack trace is:

invalid output was: Traceback (most recent call last):
File “/home/kk/.ansible/tmp/ansible-1369793563.52-51180351954149/lineinfile”, line 1218, in
main()
File “/home/kk/.ansible/tmp/ansible-1369793563.52-51180351954149/lineinfile”, line 318, in main
ins_aft, ins_bef, create, backup, backrefs)
File “/home/kk/.ansible/tmp/ansible-1369793563.52-51180351954149/lineinfile”, line 239, in present
write_changes(module, lines, dest)
File “/home/kk/.ansible/tmp/ansible-1369793563.52-51180351954149/lineinfile”, line 139, in write_changes
module.atomic_move(tmpfile, dest)
File “/home/kk/.ansible/tmp/ansible-1369793563.52-51180351954149/lineinfile”, line 1147, in atomic_move
cleanup(tmp_dest)
NameError: global name ‘cleanup’ is not defined

Regards,

I guess this avoids the crash.

https://github.com/ansible/ansible/pull/3047

Regards,

Merged, thanks!

Someone was not testing that error path and has now been sacked*

  • = oh no, probably me! :slight_smile:

:slight_smile: Thanks! But i still cant figure out what case that error would come up, The file has write permissions , i even made it 777 and still it fails.

Any tips on how to debug and fix ?

Regards,

Nope, this was me, I changed the function scope not realizing it became a method.