From 578e881142e8a244383fe53f9e7f163bda6bccbf Mon Sep 17 00:00:00 2001 From: Matt Bray Date: Mon, 16 Jun 2014 11:58:59 +0100 Subject: [PATCH] fix for urls like ssh://git@github.com/ansible/ansible.git --- lib/ansible/module_utils/known_hosts.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/known_hosts.py b/lib/ansible/module_utils/known_hosts.py index ecfdf639fe..0af70c8f8d 100644 --- a/lib/ansible/module_utils/known_hosts.py +++ b/lib/ansible/module_utils/known_hosts.py @@ -50,7 +50,7 @@ def add_git_host_key(module, url, accept_hostkey=True, create_dir=True): if rc != 0: module.fail_json(msg="failed to add %s hostkey: %s" % (fqdn, out + err)) else: - module.fail_json(msg="%s has an unknown hostkey. Set accept_hostkey to True or manually add the hostkey prior to running the git module" % fqdn) + module.fail_json(msg="%s has an unknown hostkey. Set accept_hostkey to True or manually add the hostkey prior to running the git module" % fqdn) def get_fqdn(repo_url): @@ -71,6 +71,8 @@ def get_fqdn(repo_url): parts = urlparse.urlparse(repo_url) if parts[1] != '': result = parts[1] + if "@" in result: + result = result.split("@", 1)[1] return result