From 953dc6b345d8c7bf4559ee90dbc26c468a40f5ae Mon Sep 17 00:00:00 2001 From: Rob Smith Date: Mon, 20 Jan 2014 18:56:39 -0800 Subject: [PATCH] When not finding a host in ~/.ssh/known_hosts, the return value is 0 if the host just is not found. We then never check the system host file in /etc. This fixes the code to check /etc on any failure, not just a bad return code. --- lib/ansible/module_utils/known_hosts.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/ansible/module_utils/known_hosts.py b/lib/ansible/module_utils/known_hosts.py index b1b8affce0..0fa55774c4 100644 --- a/lib/ansible/module_utils/known_hosts.py +++ b/lib/ansible/module_utils/known_hosts.py @@ -40,8 +40,7 @@ def check_hostkey(module, fqdn): this_cmd = keygen_cmd + " -H -F " + fqdn rc, out, err = module.run_command(this_cmd) - if rc == 0: - if out != "": + if rc == 0 and out != "": result = True else: # Check the main system location