more logging fixes 75/27575/4
authorRoss Brattain <ross.b.brattain@intel.com>
Thu, 26 Jan 2017 00:15:24 +0000 (16:15 -0800)
committerRoss Brattain <ross.b.brattain@intel.com>
Wed, 8 Feb 2017 07:58:04 +0000 (23:58 -0800)
don't use .format() with logging, use regular %s logginer formatter

Change-Id: I1ce0d81cc3f81c35003ef453e82c57faeb46c49f
Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
yardstick/benchmark/scenarios/availability/attacker/attacker_general.py
yardstick/benchmark/scenarios/availability/result_checker/result_checker_general.py
yardstick/benchmark/scenarios/availability/scenario_general.py
yardstick/common/openstack_utils.py
yardstick/dispatcher/influxdb.py

index 38a9668..24888af 100644 (file)
@@ -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,
index 75c433a..8f987a6 100644 (file)
@@ -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(
index 2d7ce66..a950ef9 100644 (file)
@@ -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
index e351d16..5026e81 100644 (file)
@@ -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
 
index 427e669..d388d28 100644 (file)
@@ -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: