-
Notifications
You must be signed in to change notification settings - Fork 115
Description
tl;dr: Regex for prompt parsing of output searches for > as end of the prompt. This causes an issue with command outputs that include >, which causes trigger to think that this is a break for new output.
Consider the output below:
khardson@hostname> show bgp neighbor 1.1.1.1 | match Flags Type: External State: Established Flags: <Sync RSync>
Here is the results that trigger got when running this command:
INFO:twisted:Got results: [' Type: External State: Established Flags: <Sync ', '{master}\r\n']
Notice that RSync> is not in the result, and that there are 2 results for one command.
The logs shows that trigger thinks that RSync> is the prompt, causing it to think there is a non-existent second command's output after the RSync>.
Below are the full logs:
INFO:twisted:[hostname] BYTES: '\r\n'
INFO:twisted:[hostname] BYTES: ' Type: External State: Established Flags: <Sync RSync>\r\n'
INFO:twisted:[hostname] STATE: buffer '\rkhardson@hostname> ...\x08\x08\x08\x08\rkhardson@hostmane> ...\x08\x08\x08\x08\rkhardson@hostname> [TRUNCATED]......\x08\x08\x08\x08\r\n Type: External State: Established Flags: <Sync RSync>\r\n'
INFO:twisted:[hostname] STATE: prompt 'RSync>\r'
INFO:twisted:[hostname] STATE: result ' Type: External State: Established Flags: <Sync '
INFO:twisted:[hostname] BYTES: '\r\n'
INFO:twisted:[hostname] BYTES: '{master}\r\nkhardson@hostname> '
INFO:twisted:[hostname] STATE: buffer '\r\n{master}\r\nkhardson@hostname> '
INFO:twisted:[hostname] STATE: prompt 'khardson@hostname> '
INFO:twisted:[hostname] STATE: result '{master}\r\n'
INFO:twisted:[hostname] CHANNEL: out of commands, closing connection...
INFO:twisted:[hostname] Forcefully closing transport connection
INFO:twisted:Got disconnect request, reason: 10, desc: 'user closed connection'
INFO:twisted:Disconnecting with error, code 10
reason: user closed connection
INFO:twisted:[hostname] CHANNEL: out of commands, closing connection...
INFO:twisted:[hostname] Forcefully closing transport connection
INFO:twisted:Got disconnect request, reason: 10, desc: 'user closed connection'
> /home/khardson/tmp/timedog/neteng/timedog/plugins/peer_manager/configure.py(801)parse_template()
INFO:twisted:Disconnecting with error, code 10
reason: user closed connection
INFO:twisted:Forcefully closing transport connection!
(Pdb) INFO:twisted:Got disconnect request, reason: 10, desc: 'user closed connection'
INFO:twisted:Disconnecting with error, code 10
reason: user closed connection
INFO:twisted:connection lost
INFO:twisted:Transport connection lost: Connection was closed cleanly.
INFO:twisted:Client connection lost. Reason: [Failure instance: Traceback (failure with no frames): <class 'twisted.internet.error.ConnectionDone'>: Connection was closed cleanly.
]
INFO:twisted:Got results: [' Type: External State: Established Flags: <Sync ', '{master}\r\n']```