From 19b43cd454800b9e0c4287a5cab66595375f651a Mon Sep 17 00:00:00 2001 From: Dave Hatton Date: Sun, 8 Jul 2012 17:39:57 +0100 Subject: [PATCH] further md5 fixes --- lib/ansible/runner/__init__.py | 3 ++- lib/ansible/utils.py | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index 4253398b28d..41d2b834c6b 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -746,7 +746,8 @@ class Runner(object): test = "[[ -r %s ]]" % path md5s = [ "(%s && /usr/bin/md5sum %s 2>/dev/null)" % (test,path), - "(%s && /sbin/md5sum -q %s 2>/dev/null)" % (test,path) + "(%s && /sbin/md5sum -q %s 2>/dev/null)" % (test,path), + "(%s && /usr/bin/digest -a md5 -v %s 2>/dev/null)" % (test,path) ] cmd = " || ".join(md5s) cmd = "%s || (echo \"0 %s\")" % (cmd, path) diff --git a/lib/ansible/utils.py b/lib/ansible/utils.py index d54d00042bf..0c72f8ae5fd 100644 --- a/lib/ansible/utils.py +++ b/lib/ansible/utils.py @@ -314,7 +314,14 @@ def parse_kv(args): def local_md5(file): ''' compute local md5sum, return None if file is not present ''' - cmd = "/usr/bin/md5sum %s 2> /dev/null || /sbin/md5 -q %s" % (file,file) + #was >>> cmd = "/usr/bin/md5sum %s 2> /dev/null || /sbin/md5 -q %s" % (file,file) + md5s = [ + "(/usr/bin/md5sum %s 2>/dev/null)" % (file), + "(/sbin/md5sum -q %s 2>/dev/null)" % (file), + "(/usr/bin/digest -a md5 -v %s 2>/dev/null)" % (file) + ] + cmd = " || ".join(md5s) + if not os.path.exists(file): return None else: