From 40ff3eb106709094942f02d15b21271e354d5656 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Wed, 8 Aug 2012 21:19:20 -0400 Subject: [PATCH] Catch socket errors so if you control-c a playbook it does not traceback --- lib/ansible/runner/__init__.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index e907bea4c5..ec71af5fe4 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -28,6 +28,7 @@ import base64 import getpass import codecs import collections +import socket import re import ansible.constants as C @@ -741,8 +742,11 @@ class Runner(object): worker.join() results = [] - while not result_queue.empty(): - results.append(result_queue.get(block=False)) + try: + while not result_queue.empty(): + results.append(result_queue.get(block=False)) + except socket.error: + raise errors.AnsibleError("") return results # *****************************************************