osmo_interact/common: ignore trailing empty lines in received results

If the VTY/CTRL output contains trailing newlines, do not cause those to
trigger mismatch errors, rather drop those.

Rationale: in transcript scripts, the amount of empty lines between expected
results is ignored, to allow cosmetically arranging into sections. So trailing
newlines are dropped, and there is no way to preserve those.

Change-Id: I1930868451c5738b17e318a9807590d948210b9a
This commit is contained in:
Neels Hofmeyr 2018-09-10 15:49:54 +02:00
parent b0621451e3
commit e0325b432b
1 changed files with 4 additions and 0 deletions

View File

@ -175,6 +175,10 @@ class Interact:
step.verify_interact_state(self)
res = self.command(step.command)
# trailing empty lines in the command output cannot be preserved because we allow
# arbitrary newlines between commands. Do not even track these.
while res and not res[-1]:
res = res[:-1]
if self.verbose:
sys.stderr.flush()