From 448c89a06d2208a0f0db4711db7681eac994be57 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Thu, 11 Oct 2012 07:43:56 -0400 Subject: [PATCH] It has been reported that occasionally the md5sum command on certain platforms (?) can fail, where I suspect there is noise in the output stream. In those events, capture the output so we can report the error more properly. --- lib/ansible/runner/__init__.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index dcc30f970e6..5a0f1f32cd1 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -27,6 +27,7 @@ import time import collections import socket import base64 +import sys import ansible.constants as C import ansible.inventory @@ -463,8 +464,17 @@ class Runner(object): cmd = " || ".join(md5s) cmd = "%s; %s || (echo \"${rc} %s\")" % (test, cmd, path) data = self._low_level_exec_command(conn, cmd, tmp, sudoable=False) - data = utils.last_non_blank_line(data) - return data.split()[0] + data2 = utils.last_non_blank_line(data) + try: + return data2.split()[0] + except: + sys.stderr.write("warning: md5sum command failed unusually, please report this to the list so it can be fixed\n") + sys.stderr.write("command: %s\n" % md5s) + sys.stderr.write("----\n") + sys.stderr.write("output: %s\n" % data) + sys.stderr.write("----\n") + # this will signal that it changed and allow things to keep going + return "INVALIDMD5SUM" # *****************************************************