napalm-automation / napalm-salt

Modules for event-driven network automation and orchestration using Salt
Apache License 2.0
127 stars 36 forks source link

Can´t stop a loop for a show command #61

Open Robjul opened 5 years ago

Robjul commented 5 years ago

Hi everyone

I´m new here so I´ll apreciate all your support (note: sorry for my weak english)

So I have a problem wht my code I try to do a cycle whit a "show" command, this is my code:

show = net_connect.send_command_timing("show sbc adjacency ", strip_prompt=False)

while True: if "--More--" in show: show += net_connect.send_command.timing("\n", strip_prompt=false) print(show)

The reason to do this it's because the command "show sbc adjacency" display a lot of info and I need to press "enter" to display all of them.

So I need to stop the loop, I tried to this code but it doesnt work:

while True: if "--More--" in show: show *= net_connect.send_command.timing("\n", strip_prompt=false) print(show) break return show

Could you please tell me a possible solution.

Thanks!!