From: Ondrej Lichtner olichtne@redhat.com
The hash now includes the testUid of the Test that the TestExecution object is associated with.
The method also accepts a new parameter - ignore which is a list of parameter patterns, if a parameter matches one of these patterns then it's skipped and not included into the final hash. This can be used to skip the redhat-release and kernel-release parameters.
Signed-off-by: Ondrej Lichtner olichtne@redhat.com --- lnst/Controller/Task.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/lnst/Controller/Task.py b/lnst/Controller/Task.py index 6de30de..16da88e 100644 --- a/lnst/Controller/Task.py +++ b/lnst/Controller/Task.py @@ -11,6 +11,7 @@ rpazdera@redhat.com (Radek Pazdera) """
import hashlib +import re from lnst.Controller.PerfRepo import PerfRepoRESTAPI from lnst.Controller.PerfRepo import PerfRepoTestExecution from lnst.Controller.PerfRepo import PerfRepoValue @@ -577,14 +578,22 @@ class PerfRepoResult(object): def get_testExecution(self): return self._testExecution
- def generate_hash(self): + def generate_hash(self, ignore=[]): tags = self._testExecution.get_tags() params = self._testExecution.get_parameters()
sha1 = hashlib.sha1() + sha1.update(self._testExecution.get_testUid()) for i in sorted(tags): sha1.update(i) for i in sorted(params, key=lambda x: x[0]): + skip = False + for j in ignore: + if re.search(j, i[0]): + skip = True + break + if skip: + continue sha1.update(i[0]) sha1.update(i[1]) return sha1.hexdigest()