laforge has submitted this change. ( https://gerrit.osmocom.org/c/python/osmo-python-tests/+/32063 )
Change subject: InteractVty: re.escape() the VTY prompt in connect() ......................................................................
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(-)
Approvals: Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve osmith: Looks good to me, approved laforge: Looks good to me, approved
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())