From 1a3a5b10bc0492760c0eaecd5f626403e82ae172 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Wed, 19 Oct 2016 15:01:12 -0600 Subject: [PATCH] Move suite.util.build_git_url to repo_utils Signed-off-by: Zack Cerza --- teuthology/repo_utils.py | 15 +++++++++++++++ teuthology/suite/util.py | 16 +--------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/teuthology/repo_utils.py b/teuthology/repo_utils.py index a815f35549..93ac41bf22 100644 --- a/teuthology/repo_utils.py +++ b/teuthology/repo_utils.py @@ -1,6 +1,7 @@ import fcntl import logging import os +import re import shutil import subprocess import time @@ -36,6 +37,20 @@ def is_fresh(path): return False +def build_git_url(project, project_owner='ceph'): + """ + Return the git URL to clone the project + """ + if project == 'ceph-qa-suite': + base = config.get_ceph_qa_suite_git_url() + elif project == 'ceph': + base = config.get_ceph_git_url() + else: + base = 'https://github.com/{project_owner}/{project}' + url_templ = re.sub('\.git$', '', base) + return url_templ.format(project_owner=project_owner, project=project) + + def ls_remote(url, ref): """ Return the current sha1 for a given repository and ref diff --git a/teuthology/suite/util.py b/teuthology/suite/util.py index 7dd78c010b..8d372769f1 100644 --- a/teuthology/suite/util.py +++ b/teuthology/suite/util.py @@ -1,7 +1,6 @@ import copy import logging import os -import re import requests import smtplib import socket @@ -19,6 +18,7 @@ from ..misc import deep_merge from ..repo_utils import fetch_qa_suite, fetch_teuthology from ..orchestra.opsys import OS from ..packaging import get_builder_project +from ..repo_utils import build_git_url from ..task.install import get_flavor log = logging.getLogger(__name__) @@ -205,20 +205,6 @@ def git_validate_sha1(project, sha1, project_owner='ceph'): return None -def build_git_url(project, project_owner='ceph'): - """ - Return the git URL to clone the project - """ - if project == 'ceph-qa-suite': - base = config.get_ceph_qa_suite_git_url() - elif project == 'ceph': - base = config.get_ceph_git_url() - else: - base = 'https://github.com/{project_owner}/{project}' - url_templ = re.sub('\.git$', '', base) - return url_templ.format(project_owner=project_owner, project=project) - - def git_branch_exists(project, branch, project_owner='ceph'): """ Query the git repository to check the existence of a project's branch -- 2.39.5