From 706ba9fd9a03eb92b47bd4c58caf90043b99b126 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Wed, 28 Mar 2012 20:32:04 -0400 Subject: [PATCH] Add paramiko/pycrypto atfork workaround (can back out later if not useful), tweak error message text per skvidal's suggestion --- lib/ansible/connection.py | 2 +- lib/ansible/runner.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/ansible/connection.py b/lib/ansible/connection.py index f2866cd538..a8b1da0b94 100755 --- a/lib/ansible/connection.py +++ b/lib/ansible/connection.py @@ -70,7 +70,7 @@ class ParamikoConnection(object): ) except Exception, e: if str(e).find("PID check failed") != -1: - raise errors.AnsibleError("paramiko version issue, please upgrade paramiko on the overlord") + raise errors.AnsibleError("paramiko version issue, please upgrade paramiko on the machine running ansible") else: raise errors.AnsibleConnectionFailed(str(e)) return self diff --git a/lib/ansible/runner.py b/lib/ansible/runner.py index b8e57f2e93..c38533ab19 100755 --- a/lib/ansible/runner.py +++ b/lib/ansible/runner.py @@ -33,12 +33,26 @@ import ansible.connection from ansible import utils from ansible import errors from ansible import callbacks as ans_callbacks + +HAS_ATFORK=True +try: + print "DEBUG: I have atfork" + from Crypto.Random import atfork +except ImportError: + print "DEBUG: I have no atfork, this won't help my problem" + HAS_ATFORK=False ################################################ def _executor_hook(job_queue, result_queue): ''' callback used by multiprocessing pool ''' + # attempt workaround of https://github.com/newsapps/beeswithmachineguns/issues/17 + # does not occur for everyone, some claim still occurs on newer paramiko + # this function not present in CentOS 6 + if HAS_ATFORK: + atfork() + signal.signal(signal.SIGINT, signal.SIG_IGN) while not job_queue.empty(): try: