From: Zack Cerza Date: Thu, 1 Sep 2016 18:36:23 +0000 (-0600) Subject: Add and use get_builder_project() X-Git-Tag: 1.1.0~522^2~15 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d09d63559a4ef56ea6aed129bfafa6e25583d83b;p=teuthology.git Add and use get_builder_project() Signed-off-by: Zack Cerza --- diff --git a/teuthology/packaging.py b/teuthology/packaging.py index d779420f8..ce3ca9a78 100644 --- a/teuthology/packaging.py +++ b/teuthology/packaging.py @@ -817,3 +817,15 @@ class ShamanProject(GitbuilderProject): def _get_package_version(self): self.assert_result() return self._result.json()[0]['extra']['package_manager_version'] + + +def get_builder_project(): + """ + Depending on whether config.use_shaman is True or False, return + GitbuilderProject or ShamanProject (the class, not an instance). + """ + if config.use_shaman is True: + builder_class = ShamanProject + else: + builder_class = GitbuilderProject + return builder_class diff --git a/teuthology/suite/util.py b/teuthology/suite/util.py index e3a476b99..4f7cf99df 100644 --- a/teuthology/suite/util.py +++ b/teuthology/suite/util.py @@ -17,7 +17,7 @@ from ..exceptions import BranchNotFoundError, ScheduleFailError from ..misc import deep_merge from ..repo_utils import fetch_qa_suite, fetch_teuthology from ..orchestra.opsys import OS -from ..packaging import GitbuilderProject +from ..packaging import get_builder_project from ..task.install import get_flavor log = logging.getLogger(__name__) @@ -99,7 +99,7 @@ def get_gitbuilder_hash(project=None, branch=None, flavor=None, (arch, release, _os) = get_distro_defaults(distro, machine_type) if distro is None: distro = _os.name - gp = GitbuilderProject( + bp = get_builder_project()( project, dict( branch=branch, @@ -109,7 +109,7 @@ def get_gitbuilder_hash(project=None, branch=None, flavor=None, arch=arch, ), ) - return gp.sha1 + return bp.sha1 def get_distro_defaults(distro, machine_type): @@ -147,7 +147,7 @@ def get_distro_defaults(distro, machine_type): else: raise ValueError("Invalid distro value passed: %s", distro) _os = OS(name=os_type, version=os_version) - release = GitbuilderProject._get_distro( + release = get_builder_project()._get_distro( _os.name, _os.version, _os.codename, @@ -262,7 +262,7 @@ def package_version_for_hash(hash, kernel_flavor='basic', distro='rhel', (arch, release, _os) = get_distro_defaults(distro, machine_type) if distro in (None, 'None'): distro = _os.name - gp = GitbuilderProject( + bp = get_builder_project()( 'ceph', dict( flavor=kernel_flavor, @@ -272,7 +272,7 @@ def package_version_for_hash(hash, kernel_flavor='basic', distro='rhel', sha1=hash, ), ) - return gp.version + return bp.version def get_arch(machine_type):