]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Fix Ansible.fetch_repo() for git:// URLs
authorZack Cerza <zack@redhat.com>
Thu, 21 May 2015 17:06:04 +0000 (11:06 -0600)
committerZack Cerza <zack@redhat.com>
Fri, 22 May 2015 19:20:39 +0000 (13:20 -0600)
With unit test

Signed-off-by: Zack Cerza <zack@redhat.com>
teuthology/task/ansible.py
teuthology/test/task/test_ansible.py

index cd51bccaf2bc87c995ee979c76c06c9b0b38d1a0..8d6684e77bf7bd67d1a1bc54d270a62d9013f6fd 100644 (file)
@@ -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'),
index 2ce703eb3c0559eac453afe802b43a1487085da6..f9fc9d1281c97574c609ca033b1fa7f1414253c8 100644 (file)
@@ -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(