X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=yardstick%2Fcommon%2Ftask_template.py;h=9acc213362b9c47f34edc2b32b0870c70535465b;hb=4ea6acb22260ba5076857136c95a6f9223c9f7c5;hp=2739323bdcac9bac7bd60e4de5c111d723448440;hpb=2aa1cd3922f26b9d8c9bdad310463caa5eeb8136;p=yardstick.git diff --git a/yardstick/common/task_template.py b/yardstick/common/task_template.py index 2739323bd..9acc21336 100755 --- a/yardstick/common/task_template.py +++ b/yardstick/common/task_template.py @@ -7,12 +7,14 @@ # http://www.apache.org/licenses/LICENSE-2.0 # yardstick: this file is copied from rally and slightly modified ############################################################################## +from __future__ import absolute_import import re import jinja2 import jinja2.meta class TaskTemplate(object): + @classmethod def render(cls, task_template, **kwargs): """Render jinja2 task template to Yardstick input task. @@ -43,11 +45,11 @@ def is_really_missing(mis, task_template): # Removing variables that have default values from # missing. Construction that won't be properly # check is {% set x = x or 1} - if re.search(mis.join(["{%\s*set\s+", "\s*=\s*", "[^\w]+"]), + if re.search(mis.join([r"{%\s*set\s+", "\s*=\s*", r"[^\w]+"]), task_template): return False # Also check for a default filter which can show up as # a missing variable - if re.search(mis + "\s*\|\s*default\(", task_template): + if re.search(mis + r"\s*\|\s*default\(", task_template): return False return True