From df24523e88d06fbae3859e1fbf95c282bc98bf4a Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Thu, 21 May 2015 11:06:04 -0600 Subject: [PATCH] Fix Ansible.fetch_repo() for git:// URLs With unit test Signed-off-by: Zack Cerza --- teuthology/task/ansible.py | 2 +- teuthology/test/task/test_ansible.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/teuthology/task/ansible.py b/teuthology/task/ansible.py index cd51bccaf2..8d6684e77b 100644 --- a/teuthology/task/ansible.py +++ b/teuthology/task/ansible.py @@ -99,7 +99,7 @@ class Ansible(Task): Locate the repo we're using; cloning it from a remote repo if necessary """ repo = self.config.get('repo', '.') - if repo.startswith(('http://', 'https://', 'git@')): + if repo.startswith(('http://', 'https://', 'git@', 'git://')): repo_path = fetch_repo( repo, self.config.get('branch', 'master'), diff --git a/teuthology/test/task/test_ansible.py b/teuthology/test/task/test_ansible.py index 2ce703eb3c..f9fc9d1281 100644 --- a/teuthology/test/task/test_ansible.py +++ b/teuthology/test/task/test_ansible.py @@ -66,6 +66,16 @@ class TestAnsibleTask(TestTask): task.find_repo() assert task.repo_path == os.path.expanduser(task_config['repo']) + @patch('teuthology.task.ansible.fetch_repo') + def test_find_repo_path_remote(self, m_fetch_repo): + task_config = dict( + repo='git://fake_host/repo.git', + ) + m_fetch_repo.return_value = '/tmp/repo' + task = Ansible(self.ctx, task_config) + task.find_repo() + assert task.repo_path == os.path.expanduser('/tmp/repo') + @patch('teuthology.task.ansible.fetch_repo') def test_find_repo_http(self, m_fetch_repo): task_config = dict( -- 2.39.5