Commit a948dbfa authored by Xavier Thompson's avatar Xavier Thompson

promise: Fix slapgrid version parse for comparison

Promise launcher compares current slapgrid version with an old version
number to determine if some feature is supported or if it should use a
legacy workaround. But the comparison was a simple lexicographic order
string comparison, and now that we incremented from 1.9.3 to 1.10.0 it
wrongly compared the versions. Fix it with pkg_resources.parse_version.
parent e0598760
...@@ -41,6 +41,8 @@ import six ...@@ -41,6 +41,8 @@ import six
from six import PY3, with_metaclass from six import PY3, with_metaclass
from datetime import datetime, timedelta from datetime import datetime, timedelta
from pkg_resources import parse_version
PROMISE_STATE_FOLDER_NAME = '.slapgrid/promise' PROMISE_STATE_FOLDER_NAME = '.slapgrid/promise'
PROMISE_RESULT_FOLDER_NAME = '.slapgrid/promise/result' PROMISE_RESULT_FOLDER_NAME = '.slapgrid/promise/result'
PROMISE_LOG_FOLDER_NAME = '.slapgrid/promise/log' PROMISE_LOG_FOLDER_NAME = '.slapgrid/promise/log'
...@@ -493,8 +495,9 @@ class GenericPromise(with_metaclass(ABCMeta, object)): ...@@ -493,8 +495,9 @@ class GenericPromise(with_metaclass(ABCMeta, object)):
)) ))
elif (not self.__is_tested and not check_anomaly) or \ elif (not self.__is_tested and not check_anomaly) or \
(not self.__is_anomaly_detected and check_anomaly): (not self.__is_anomaly_detected and check_anomaly):
# Anomaly or Test is disabled on this promise, send empty result # Anomaly or Test is disabled on this promise, send empty
if self.getConfig('slapgrid-version', '') <= '1.4.17': slapgrid_version = self.getConfig('slapgrid-version', '')
if parse_version(slapgrid_version) <= parse_version('1.4.17'):
# old version cannot send EmptyResult # old version cannot send EmptyResult
self.__sendResult(PromiseQueueResult(item=TestResult())) self.__sendResult(PromiseQueueResult(item=TestResult()))
else: else:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment