Fix Huawei telnet ReadException: Unable to successfully split output based on pattern #2935
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes #2711
Root cause:
Unexpected nested group in regex pattern "combined_pattern".
For details please see: #2711 (comment).
Solution:
Change
password_change_prompt
regex group to non-capturing group. This change avoids nested group incombined_pattern
, that solves the root cause. Actually nested group still presents incombined_pattern
, but since this group is a non-capturing group, this solves the issue.Side effects (not detected):
password_change_prompt
used inre.search(password_change_prompt, output)
statement. I've tested that changing group to non-capturing group do not affect there.search
statement.password_change_prompt
will need to be passed inside theread_until_pattern
method in future. In this case it also will not be a problem, because non-capturing group will be wrapped with parentheses which will change non-capturing group back to regular group, see linepattern = f"({pattern})"
:P.S. @ktbyers thank you for non-capturing group idea 馃憤