Skip to content

Commit

Permalink
Allow user to choose Tempest remote repo
Browse files Browse the repository at this point in the history
User can now work with alternative Tempest repos

Change-Id: I464c244e318860f7c05e0438130ccc2dbd90e08f
  • Loading branch information
Yair Fried committed Jan 20, 2015
1 parent 841a578 commit fd85bfa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
7 changes: 5 additions & 2 deletions rally/cmd/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,15 @@ class TempestCommands(object):
required=False, help="UUID of the deployment.")
@cliutils.args("--deployment", type=str, dest="deployment",
required=False, help="UUID or name of the deployment")
@cliutils.args("--source", type=str, dest="source",
required=False, help="Path/URL to repo to pull tempest "
"from.")
@envutils.with_default_deployment
def install(self, deployment=None):
def install(self, deployment=None, source=None):
"""Install tempest."""

deployment_uuid = db.deployment_get(deployment)['uuid']
verifier = tempest.Tempest(deployment_uuid)
verifier = tempest.Tempest(deployment_uuid, source=source)
verifier.install()


Expand Down
13 changes: 8 additions & 5 deletions rally/verification/tempest/tempest.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
from rally.verification.tempest import config
from rally.verification.tempest import subunit2json

TEMPEST_SOURCE = "https://github.com/openstack/tempest"

LOG = logging.getLogger(__name__)


Expand All @@ -52,7 +54,9 @@ class Tempest(object):

base_repo = os.path.join(os.path.expanduser("~"), ".rally/tempest/base")

def __init__(self, deployment, verification=None, tempest_config=None):
def __init__(self, deployment, verification=None, tempest_config=None,
source=None):
self.tempest_source = source or TEMPEST_SOURCE
self.deployment = deployment
self._path = os.path.join(os.path.expanduser("~"),
".rally/tempest",
Expand Down Expand Up @@ -129,19 +133,18 @@ def _initialize_testr(self):
def is_installed(self):
return os.path.exists(self.path(".venv"))

@staticmethod
def _clone():
def _clone(self):
print("Please wait while tempest is being cloned. "
"This could take a few minutes...")
subprocess.check_call(["git", "clone",
"https://github.com/openstack/tempest",
self.tempest_source,
Tempest.base_repo])

def install(self):
if not self.is_installed():
try:
if not os.path.exists(Tempest.base_repo):
Tempest._clone()
self._clone()

if not os.path.exists(self.path()):
shutil.copytree(Tempest.base_repo, self.path())
Expand Down

0 comments on commit fd85bfa

Please sign in to comment.