Why fetch yielded md5 mismatch message?

I am new to Ansible - still going over the wiki and practicing using 5
KVM guests running SL6.2. Ansible 5.0 cloned from github is used.

While reviewing http://ansible.github.com/modules.html and practicing
the fetch module, I did:

[root@sl0 ~]# mkdir logtree
[root@sl0 ~]# ansible all -m fetch -a "src=/var/log/messages dest=/
root/logtree"
sl4 | FAILED >> {
    "failed": true,
    "md5sum": "a62b77d7291707bf19fdd40e43fae390",
    "msg": "md5 mismatch"
}

sl3 | FAILED >> {
    "failed": true,
    "md5sum": "54c9f21817602192176b086db61bdb73",
    "msg": "md5 mismatch"
}

sl1 | FAILED >> {
    "failed": true,
    "md5sum": "59a9739eb255d06705b2ea401ca8cc20",
    "msg": "md5 mismatch"
}

sl2 | FAILED >> {
    "failed": true,
    "md5sum": "e4d639a1f2853d3799a9af9c026d9dcd",
    "msg": "md5 mismatch"
}

Note all these FAILED and 'md5 mismatch' messages. What did I do
wrong? I did get the following:

[root@sl0 ~]# ls -lR logtree
logtree:
total 16
drwxr-xr-x 3 root root 4096 Jun 6 21:17 sl1
drwxr-xr-x 3 root root 4096 Jun 6 21:17 sl2
drwxr-xr-x 3 root root 4096 Jun 6 21:17 sl3
drwxr-xr-x 3 root root 4096 Jun 6 21:17 sl4

logtree/sl1:
total 4
drwxr-xr-x 3 root root 4096 Jun 6 21:17 var

logtree/sl1/var:
total 4
drwxr-xr-x 2 root root 4096 Jun 6 21:17 log

logtree/sl1/var/log:
total 52
-rw-r--r-- 1 root root 50065 Jun 6 21:17 messages

logtree/sl2:
total 4
drwxr-xr-x 3 root root 4096 Jun 6 21:17 var

logtree/sl2/var:
total 4
drwxr-xr-x 2 root root 4096 Jun 6 21:17 log

logtree/sl2/var/log:
total 52
-rw-r--r-- 1 root root 50063 Jun 6 21:17 messages

logtree/sl3:
total 4
drwxr-xr-x 3 root root 4096 Jun 6 21:17 var

logtree/sl3/var:
total 4
drwxr-xr-x 2 root root 4096 Jun 6 21:17 log

logtree/sl3/var/log:
total 52
-rw-r--r-- 1 root root 49954 Jun 6 21:17 messages

logtree/sl4:
total 4
drwxr-xr-x 3 root root 4096 Jun 6 21:17 var

logtree/sl4/var:
total 4
drwxr-xr-x 2 root root 4096 Jun 6 21:17 log

logtree/sl4/var/log:
total 52
-rw-r--r-- 1 root root 50065 Jun 6 21:17 messages

Regards,

Zack

Don’t know, find the code that says “md5 mismatch”, add some debug, and see what two things it is comparing.

Running from OS X perhaps? Then it’s a known issue.

Hi Michael,

Thanks for the tip. No, I didn't use a Mac. As I stated, all KVM
guests sl[0-4] run Scientific Linux 6.2, including the ansible control
host sl0. I also doubled checked:

[root@sl0 ~]# which md5sum
/usr/bin/md5sum
[root@sl0 ~]# ssh root@sl1
Enter passphrase for key '/root/.ssh/id_rsa':
Last login: Wed Jun 6 22:55:21 2012 from sl0
[root@sl1 ~]# which md5sum
/usr/bin/md5sum

But you were right, in /usr/lib/python2.6/site-packages/ansible/runner/
__init__.py, I did see the following:

   476 # compare old and new md5 for support of change hooks
   477 local_md5 = None
   478 if os.path.exists(dest):
   479 local_md5 = os.popen("md5sum %s" %
dest).read().split()[0]
   480 remote_md5 = self._low_level_exec_command(conn,
"md5sum %s" % source, tmp, True)[0].split()[0]
   481
   482 if remote_md5 != local_md5:
   483 # create the containing directories, if needed
   484 os.makedirs(os.path.dirname(dest))
   485
   486 # fetch the file and check for changes
   487 conn.fetch_file(source, dest)
   488 new_md5 = os.popen("md5sum %s" %
dest).read().split()[0]
   489 if new_md5 != remote_md5:
   490 result = dict(failed=True, msg="md5 mismatch",
md5sum=new_md5)
   491 return ReturnData(host=conn.host,
result=result)
   492 result = dict(changed=True, md5sum=new_md5)
   493 return ReturnData(host=conn.host, result=result)

Late this afternoon, I anticipate to have a bit of quiet time. I will
do what you suggested and "fix" it.

Regards,

Zack

Hi Michael,

I ran /usr/bin/ansible under pdb in GNU Emacs. After setting three
break points, and used -f 1 to avoid the use of the Python
multiprocessing module (the default self.focks is set to 5), so that
the function _execute_fetch(self, conn, tmp): gets called directly. I
was able to pin-point the bug in line 480 in my previous post.

Nevertheless, when I went to github to prepare to submit a patch, it
had already been taken care of and Michael had merged it into the
master. So, I simply cloned again and now fetch works fine.

Thank you and Best Regards,

Zack