lineinfile fails with a path only containing a file name

Hello,

It seems that I found a bug with the lineinfile module:

  • name: lineinfile fails with a path only containing a file name
    lineinfile: dest=afile regexp=“something” line=“something”

It fails with an error like:

failed: [iterativeocean.biz] => {“failed”: true, “item”: “”, “parsed”: false}
invalid output was: Traceback (most recent call last):
File “/home/pierre/.ansible/tmp/ansible-1378933589.79-184488600904880/lineinfile”, line 1255, in
main()
File “/home/pierre/.ansible/tmp/ansible-1378933589.79-184488600904880/lineinfile”, line 319, in main
ins_aft, ins_bef, create, backup, backrefs)
File “/home/pierre/.ansible/tmp/ansible-1378933589.79-184488600904880/lineinfile”, line 163, in present
os.makedirs(destpath)
File “/usr/lib/python2.7/os.py”, line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 2] No such file or directory: ‘’

So, in that case, the directory is empty.

I am on version 1.3 from fresh branch devel.

I am having a hard time with lineinfile. It seems that the module is completely broken. Could it be?

I wait for an answer before giving more information.

Thank you.

Module work fine for me and many others. You probably want to use an
absolute filename for dest, all the examples do. Checkout the command:

    ansible-doc lineinfile

K

Kahlil (Kal) Hodgson GPG: C9A02289
Head of Technology (m) +61 (0) 4 2573 0382
DealMax Pty Ltd (w) +61 (0) 3 9008 5281

Suite 1415
401 Docklands Drive
Docklands VIC 3008 Australia

"All parts should go together without forcing. You must remember that
the parts you are reassembling were disassembled by you. Therefore,
if you can't get them together again, there must be a reason. By all
means, do not use a hammer." -- IBM maintenance manual, 1925