Adding in bugfix for issue with manager.status().
The problem is that the status command returns output in a special format, that was not being parsed correctly. This fix is a bit ugly, but is the only way (afaik) to cleanly handle the status command so that its output can be used.develop
parent
85fc17017e
commit
60b904bf10
|
@ -274,6 +274,7 @@ class Manager(object):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
multiline = False
|
multiline = False
|
||||||
|
status = False
|
||||||
wait_for_marker = False
|
wait_for_marker = False
|
||||||
eolcount = 0
|
eolcount = 0
|
||||||
# loop while we are sill running and connected
|
# loop while we are sill running and connected
|
||||||
|
@ -303,6 +304,11 @@ class Manager(object):
|
||||||
break
|
break
|
||||||
# ignore empty lines at start
|
# ignore empty lines at start
|
||||||
continue
|
continue
|
||||||
|
# If the user executed the status command, it's a special
|
||||||
|
# case, so we need to look for a marker.
|
||||||
|
if 'status will follow' in line:
|
||||||
|
status = True
|
||||||
|
wait_for_marker = True
|
||||||
lines.append(line)
|
lines.append(line)
|
||||||
# line not ending in \r\n or without ':' isn't a
|
# line not ending in \r\n or without ':' isn't a
|
||||||
# valid header and starts multiline response
|
# valid header and starts multiline response
|
||||||
|
@ -310,13 +316,17 @@ class Manager(object):
|
||||||
multiline = True
|
multiline = True
|
||||||
# Response: Follows indicates we should wait for end
|
# Response: Follows indicates we should wait for end
|
||||||
# marker --END COMMAND--
|
# marker --END COMMAND--
|
||||||
if not multiline and line.startswith('Response') and \
|
if not (multiline or status) and line.startswith('Response') and \
|
||||||
line.split(':', 1)[1].strip() == 'Follows':
|
line.split(':', 1)[1].strip() == 'Follows':
|
||||||
wait_for_marker = True
|
wait_for_marker = True
|
||||||
# same when seeing end of multiline response
|
# same when seeing end of multiline response
|
||||||
if multiline and line.startswith('--END COMMAND--'):
|
if multiline and line.startswith('--END COMMAND--'):
|
||||||
wait_for_marker = False
|
wait_for_marker = False
|
||||||
multiline = False
|
multiline = False
|
||||||
|
# same when seeing end of status response
|
||||||
|
if status and 'StatusComplete' in line:
|
||||||
|
wait_for_marker = False
|
||||||
|
status = False
|
||||||
if not self._connected.isSet():
|
if not self._connected.isSet():
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue