diff options
author | Ross Brattain <ross.b.brattain@intel.com> | 2017-01-25 16:15:24 -0800 |
---|---|---|
committer | Ross Brattain <ross.b.brattain@intel.com> | 2017-02-07 23:58:04 -0800 |
commit | 4c2ad1b3d6f51da2c6ab4b46e48bd054758496a7 (patch) | |
tree | a274888b3204030a7d9ea6638e77c6162d8bc71b | |
parent | a4241e6e9b121447a50fdfe0d79b322c2e2aaea9 (diff) |
more logging fixes
don't use .format() with logging, use regular %s logginer formatter
Change-Id: I1ce0d81cc3f81c35003ef453e82c57faeb46c49f
Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
5 files changed, 23 insertions, 25 deletions
diff --git a/yardstick/benchmark/scenarios/availability/attacker/attacker_general.py b/yardstick/benchmark/scenarios/availability/attacker/attacker_general.py index 38a966803..24888af98 100644 --- a/yardstick/benchmark/scenarios/availability/attacker/attacker_general.py +++ b/yardstick/benchmark/scenarios/availability/attacker/attacker_general.py @@ -62,11 +62,11 @@ class GeneralAttacker(BaseAttacker): self.fault_cfg['recovery_script']) def inject_fault(self): - LOG.debug("{0} starting inject!".format(self.key)) - LOG.debug("the inject_script path:{0}".format(self.inject_script)) + LOG.debug("%s starting inject!", self.key) + LOG.debug("the inject_script path:%s", self.inject_script) if "action_parameter" in self._config: - LOG.debug("the shell command is: {0}".format(self.action_param)) + LOG.debug("the shell command is: %s", self.action_param) with open(self.inject_script, "r") as stdin_file: exit_status, stdout, stderr = self.connection.execute( self.action_param, @@ -88,7 +88,7 @@ class GeneralAttacker(BaseAttacker): def recover(self): if "rollback_parameter" in self._config: - LOG.debug("the shell command is: {0}".format(self.rollback_param)) + LOG.debug("the shell command is: %s", self.rollback_param) with open(self.recovery_script, "r") as stdin_file: exit_status, stdout, stderr = self.connection.execute( self.rollback_param, diff --git a/yardstick/benchmark/scenarios/availability/result_checker/result_checker_general.py b/yardstick/benchmark/scenarios/availability/result_checker/result_checker_general.py index 75c433a0e..8f987a647 100644 --- a/yardstick/benchmark/scenarios/availability/result_checker/result_checker_general.py +++ b/yardstick/benchmark/scenarios/availability/result_checker/result_checker_general.py @@ -61,28 +61,26 @@ class GeneralResultChecker(BaseResultChecker): exit_status, stdout, stderr = self.connection.execute( self.shell_cmd, stdin=stdin_file) - LOG.debug("action script of the operation is: {0}" - .format(self.verify_script)) - LOG.debug("action parameter the of operation is: {0}" - .format(self.shell_cmd)) + LOG.debug("action script of the operation is: %s", + self.verify_script) + LOG.debug("action parameter the of operation is: %s", + self.shell_cmd) else: with open(self.verify_script, "r") as stdin_file: exit_status, stdout, stderr = self.connection.execute( "/bin/bash -s ", stdin=stdin_file) - LOG.debug("action script of the operation is: {0}" - .format(self.verify_script)) + LOG.debug("action script of the operation is: %s", + self.verify_script) LOG.debug("exit_status ,stdout : %s ,%s", exit_status, stdout) if exit_status == 0 and stdout: self.actualResult = stdout - LOG.debug("verifying resultchecker: {0}".format(self.key)) - LOG.debug("verifying resultchecker,expected: {0}" - .format(self.expectedResult)) - LOG.debug("verifying resultchecker,actual: {0}" - .format(self.actualResult)) - LOG.debug("verifying resultchecker,condition: {0}" - .format(self.condition)) + LOG.debug("verifying resultchecker: %s", self.key) + LOG.debug("verifying resultchecker,expected: %s", + self.expectedResult) + LOG.debug("verifying resultchecker,actual: %s", self.actualResult) + LOG.debug("verifying resultchecker,condition: %s", self.condition) if (type(self.expectedResult) is int): self.actualResult = int(self.actualResult) if self.condition == Condition.EQUAL: @@ -100,13 +98,13 @@ class GeneralResultChecker(BaseResultChecker): else: self.success = False LOG.debug( - "error happened when resultchecker: {0} Invalid condition" - .format(self.key)) + "error happened when resultchecker: %s Invalid condition", + self.key) else: self.success = False LOG.debug( - "error happened when resultchecker: {0} verifying the result" - .format(self.key)) + "error happened when resultchecker: %s verifying the result", + self.key) LOG.error(stderr) LOG.debug( diff --git a/yardstick/benchmark/scenarios/availability/scenario_general.py b/yardstick/benchmark/scenarios/availability/scenario_general.py index 2d7ce664e..a950ef933 100644 --- a/yardstick/benchmark/scenarios/availability/scenario_general.py +++ b/yardstick/benchmark/scenarios/availability/scenario_general.py @@ -47,8 +47,8 @@ class ScenarioGeneral(base.Scenario): except Exception: LOG.exception("Exception") LOG.debug( - "\033[91m exception when running step: {0} .... \033[0m" - .format(orderedSteps.index(step))) + "\033[91m exception when running step: %s .... \033[0m", + orderedSteps.index(step)) break finally: pass diff --git a/yardstick/common/openstack_utils.py b/yardstick/common/openstack_utils.py index e351d16d3..5026e819d 100644 --- a/yardstick/common/openstack_utils.py +++ b/yardstick/common/openstack_utils.py @@ -65,7 +65,7 @@ def get_credentials(): creds.update({"insecure": "True", "https_insecure": "True"}) if not os.path.isfile(cacert): log.info("WARNING: The 'OS_CACERT' environment variable is set\ - to %s but the file does not exist." % cacert) + to %s but the file does not exist.", cacert) return creds diff --git a/yardstick/dispatcher/influxdb.py b/yardstick/dispatcher/influxdb.py index 427e669a2..d388d28a1 100644 --- a/yardstick/dispatcher/influxdb.py +++ b/yardstick/dispatcher/influxdb.py @@ -164,7 +164,7 @@ class InfluxdbDispatcher(DispatchBase): timeout=self.timeout) if res.status_code != 204: LOG.error('Test result posting finished with status code' - ' %d.' % res.status_code) + ' %d.', res.status_code) LOG.error(res.text) except Exception as err: |