fixeria has uploaded this change for review.

View Change

InteractVty: re.escape() the VTY prompt in connect()

The VTY prompt may contain regular expression metacharacters in it,
so the self.re_prompt will not match as expected. One example is
the modem app in osmocom-bb.git using promot 'OsmocomBB(modem)'.

Change-Id: I47b1f1c1765acb1b935dcbcc54bbb5eb539db4f0
---
M osmopy/osmo_interact/vty.py
1 file changed, 14 insertions(+), 1 deletion(-)

git pull ssh://gerrit.osmocom.org:29418/python/osmo-python-tests refs/changes/63/32063/1
diff --git a/osmopy/osmo_interact/vty.py b/osmopy/osmo_interact/vty.py
index f4b9aff..1cc299c 100755
--- a/osmopy/osmo_interact/vty.py
+++ b/osmopy/osmo_interact/vty.py
@@ -95,7 +95,7 @@
if not self.prompt:
raise Exception('Could not find application name; needed to decode prompts.'
' Initial data was: %r' % data)
- self.re_prompt = re.compile('^%s(?:\(([\w-]*)\))?([#>]) (.*)$' % self.prompt)
+ self.re_prompt = re.compile('^%s(?:\(([\w-]*)\))?([#>]) (.*)$' % re.escape(self.prompt))

def _command(self, command_str, timeout=10):
self.socket.send(command_str.encode())

To view, visit change 32063. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: python/osmo-python-tests
Gerrit-Branch: master
Gerrit-Change-Id: I47b1f1c1765acb1b935dcbcc54bbb5eb539db4f0
Gerrit-Change-Number: 32063
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de>
Gerrit-MessageType: newchange