-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Finding a interaction_complete_patterns
does not end interactive session
#318
Comments
yeah probably should be a check on buf if it contains any of the complete patterns. up for pr? if yes, please do async too :) |
for whatever reason (no good one I assume) looks like this is "correct" in scrapligo, so can probably steal from that sorta too (though guess it should be fairly straight forward fix anywho) |
On a tangent to this bug, would you also want to end the interactive session if the a interact = conn.channel.send_inputs_interact(
[
("copy flash: scp:", "Source filename []?", False),
("test1.txt", "Address or name of remote host []?", False),
("172.31.254.100", "Destination username [carl]?", False),
("carl", "Password:", False),
("super_secure_password", prompt, True),
],
failed_when_contains=["file not found"],
interaction_complete_patterns=["file not found"]
) |
hmm a good question for sure... its probably not a bad idea to add, but that is certainly more work :) in general I would kind of avoid the |
Describe the bug
According to the documentation of
send_interactive
(specifically in sync_driver.py)I take this to mean that no more input will be send if one of those patterns is seen. The actual behavior is slightly different. It handles these patterns like the prompt and continues to send input after seeing one.
This is also supported if you dig down into the code. Going
GenericDriver.send_interactive -> Channel.send_inputs_interact
you can see that it is impossible to gracefully break out of thefor interact_event in interact_events
loop (i.e. all interactive events will be sent).scrapli/scrapli/channel/sync_channel.py
Lines 644 to 670 in ac14468
The text was updated successfully, but these errors were encountered: