mirror of https://github.com/Kkevsterrr/geneva
Parse fix for trace
This commit is contained in:
parent
255ef9e5d8
commit
67414cb3e5
|
@ -65,14 +65,15 @@ class TraceAction(Action):
|
|||
"""
|
||||
Parses a string representation for this object.
|
||||
"""
|
||||
if not string:
|
||||
return False
|
||||
try:
|
||||
if string:
|
||||
self.start_ttl, self.end_ttl = string.split(":")
|
||||
self.start_ttl = int(self.start_ttl)
|
||||
self.end_ttl = int(self.end_ttl)
|
||||
if self.start_ttl > self.end_ttl:
|
||||
logger.error("Cannot use a trace with a start ttl greater than end_ttl (%d > %d)" % (self.start_ttl, self.end_ttl))
|
||||
return False
|
||||
self.start_ttl, self.end_ttl = string.split(":")
|
||||
self.start_ttl = int(self.start_ttl)
|
||||
self.end_ttl = int(self.end_ttl)
|
||||
if self.start_ttl > self.end_ttl:
|
||||
logger.error("Cannot use a trace with a start ttl greater than end_ttl (%d > %d)" % (self.start_ttl, self.end_ttl))
|
||||
return False
|
||||
except ValueError:
|
||||
logger.exception("Cannot parse ttls from given data %s" % string)
|
||||
return False
|
||||
|
|
|
@ -91,3 +91,4 @@ def test_trace_parse_handling():
|
|||
print("Testing incorrect parsing:")
|
||||
assert not actions.trace.TraceAction().parse("5:4", logger)
|
||||
assert not actions.trace.TraceAction().parse("THISHOULDFAIL", logger)
|
||||
assert not actions.trace.TraceAction().parse("", logger)
|
||||
|
|
Loading…
Reference in New Issue