From 10113e6a67fdc31ebbed62db95f4e26a9b32c040 Mon Sep 17 00:00:00 2001 From: Matt Coddington Date: Mon, 13 Oct 2014 16:07:06 -0400 Subject: [PATCH] python2.4 compatibility issue with urlparse --- lib/ansible/module_utils/known_hosts.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ansible/module_utils/known_hosts.py b/lib/ansible/module_utils/known_hosts.py index 3406e2c7da..c997596fd4 100644 --- a/lib/ansible/module_utils/known_hosts.py +++ b/lib/ansible/module_utils/known_hosts.py @@ -72,12 +72,14 @@ def get_fqdn(repo_url): if 'ssh' not in parts[0] and 'git' not in parts[0]: # don't try and scan a hostname that's not ssh return None + # parts[1] will be empty on python2.4 on ssh:// or git:// urls, so + # ensure we actually have a parts[1] before continuing. if parts[1] != '': result = parts[1] if ":" in result: result = result.split(":")[0] - if "@" in result: - result = result.split("@", 1)[1] + if "@" in result: + result = result.split("@", 1)[1] return result