From 07e2b0e8d0c0c2e6a9f978c013a4642f880cebbc Mon Sep 17 00:00:00 2001 From: Yaroslav Lobankov Date: Sat, 3 Oct 2015 18:04:05 +0300 Subject: [PATCH] Replacing 'print' with 'LOG.xxx' It is recommended to use the print() function only in rally.cli module. So this patch replaces the use of print() with LOG.xxx in the tempest.py and api.py files. Change-Id: Ifa8f9b708d002986926f5eb36c7a4ef0a2cbb131 --- rally/api.py | 6 ++++-- rally/verification/tempest/tempest.py | 16 ++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/rally/api.py b/rally/api.py index 1b819882f5..c0cb59e691 100644 --- a/rally/api.py +++ b/rally/api.py @@ -329,8 +329,10 @@ class Verification(object): tempest_config=tempest_config, system_wide_install=system_wide_install) if not verifier.is_installed(): - print("Tempest is not installed for specified deployment.") - print("Installing Tempest for deployment %s" % deployment_uuid) + LOG.info(_("Tempest is not installed " + "for the specified deployment.")) + LOG.info(_("Installing Tempest " + "for deployment: %s") % deployment_uuid) verifier.install() return verifier diff --git a/rally/verification/tempest/tempest.py b/rally/verification/tempest/tempest.py index 46662c42dd..a5fc0970b9 100644 --- a/rally/verification/tempest/tempest.py +++ b/rally/verification/tempest/tempest.py @@ -180,7 +180,8 @@ class Tempest(object): path_to_venv = self.path(".venv") if not os.path.isdir(path_to_venv): - print("No virtual environment found...Install the virtualenv.") + LOG.debug("No virtual environment for Tempest found.") + LOG.info(_("Installing the virtual environment for Tempest.")) LOG.debug("Virtual environment directory: %s" % path_to_venv) required_vers = (2, 7) if sys.version_info[:2] != required_vers: @@ -238,7 +239,7 @@ class Tempest(object): def _initialize_testr(self): if not os.path.isdir(self.path(".testrepository")): - print(_("Test Repository initialization.")) + LOG.debug("Test Repository initialization.") try: check_output("%s testr init" % self.venv_wrapper, shell=True, cwd=self.path()) @@ -251,8 +252,7 @@ class Tempest(object): return os.path.exists(self.path(".venv")) def _clone(self): - print("Please wait while tempest is being cloned. " - "This could take a few minutes...") + LOG.info(_("Please, wait while Tempest is being cloned.")) try: subprocess.check_call(["git", "clone", self.tempest_source, @@ -281,10 +281,10 @@ class Tempest(object): self.uninstall() raise TempestSetupFailure("failed cmd: '%s'" % e.cmd) else: - print("Tempest has been successfully installed!") + LOG.info(_("Tempest has been successfully installed!")) else: - print("Tempest is already installed") + LOG.info(_("Tempest is already installed.")) def uninstall(self): """Removes local Tempest repo and virtualenv for deployment @@ -311,8 +311,8 @@ class Tempest(object): try: self.run(testr_arg) except subprocess.CalledProcessError: - print("Test set '%s' has been finished with error. " - "Check log for details" % set_name) + LOG.info(_("Test set '%s' has been finished with errors. " + "Check logs for details.") % set_name) def run(self, testr_arg=None, log_file=None, tempest_conf=None): """Launch tempest with given arguments