From 3315ba0b99eb3906714638b04dd0c6b4d42f9fd8 Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Wed, 26 Mar 2014 16:40:50 -0700 Subject: [PATCH] Treat 255 errors from raw as dark host Any other module is able to detect a dark host, but raw was treating 255 as a return code from the module execution, rather from the connection attempt. This change allows 255 to be treated as a connection failure when using the raw module. --- lib/ansible/runner/connection_plugins/ssh.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/runner/connection_plugins/ssh.py b/lib/ansible/runner/connection_plugins/ssh.py index 876f2063848..410afc97841 100644 --- a/lib/ansible/runner/connection_plugins/ssh.py +++ b/lib/ansible/runner/connection_plugins/ssh.py @@ -343,7 +343,7 @@ class Connection(object): if p.returncode != 0 and controlpersisterror: raise errors.AnsibleError('using -c ssh on certain older ssh versions may not support ControlPersist, set ANSIBLE_SSH_ARGS="" (or ansible_ssh_args in the config file) before running again') - if p.returncode == 255 and in_data: + if p.returncode == 255 and (in_data or self.runner.module_name == 'raw'): raise errors.AnsibleError('SSH Error: data could not be sent to the remote host. Make sure this host can be reached over ssh') return (p.returncode, '', stdout, stderr)