Skip to content

How can I hold or disconnect the telnet connection without error ? #803

Discussion options

You must be logged in to vote

I figure out the problem, before I executed the .send_command('y') the telnet connection is disconnect, in my route, after enter the reload command if received the \n then will immediately reload the system, so it triggered the error after the send the .send_command('y')

from nornir import InitNornir
from nornir.core.task import Task, Result 
from nornir_netmiko.tasks.netmiko_send_command import netmiko_send_command

def main():
    
    def task_reboot(task):

      task.run(
          task=netmiko_send_command,
          use_timing=True,
          command_string="reload",
       )
       task.host.close_connections()

    nr = InitNornir(config_file="config.yaml")        
    r1 = nr.fi…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@Tommylulu886943
Comment options

@Tommylulu886943
Comment options

@dbarrosop
Comment options

@Tommylulu886943
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by Tommylulu886943
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants