[rancid] run_commands not liking eof/end of session

Josh Rogers 2010 at tybox.net
Tue Mar 29 19:28:14 UTC 2011


Forgot to mention jrancid version:

## $Id: jlogin.in,v 1.69 2009/04/16 21:22:57 heas Exp $

Appreciate the help/direction,
Josh

On Tue, Mar 29, 2011 at 11:36 AM, Josh Rogers <2010 at tybox.net> wrote:
> I was having trouble with rancid reporting 'hung' and lockfiles
> remaining, so I installed the patched/hack expect/tcl in hopes of
> resolving it.  Ever since, I'm seeing the following error below.
>
> Seems like eof isn't being handled properly when disconnecting, and it
> errors out?  Any ideas what is leading to this?
>
>
> $ jlogin -t 120 -c"show chassis clocks;show chassis environment;show
> chassis firmware;show chassis fpc detail;show chassis hardware
> detail;show chassis routing-engine;show chassis scb;show chassis sfm
> detail;show chassis ssb;show chassis feb detail;show chassis feb;show
> chassis cfeb;show chassis alarms;show system license;show system
> boot-messages;show system core-dumps;show version detail;show
> interfaces description;show configuration;show configuration | display
> set" rtr2
> spawn ssh -c 3des -x -l robot rtr2
> <output of show commands>
>
> {master}
> robot at re0.rtr2> quit
>
> Connection to rtr2 closed.
> bad spawn_id (process died earlier?)
>     while executing
> "expect -nobrace {
> } { exp_continue } timeout { catch {close}; catch {wait};
>                           return 0
>                         } eof { return 0 }"
>     invoked from within
> "expect {
>     "\n"                    { exp_continue }
>     timeout                    { catch {close}; catch {wait};
>                           return 0
>                         }
>     eof                    { return 0 }
>     }"
>     (procedure "run_commands" line 21)
>     invoked from within
> "run_commands $prompt $command"
>     ("foreach" body line 68)
>     invoked from within
> "foreach router [lrange $argv $i end] {
>     set router [string tolower $router]
>     send_user "$router\n"
>
>     set prompt ">"
>
>     # Figure out usernam..."
>     (file "/usr/local/bin/jlogin" line 461)
>
>
>
> $ expect -v
> expect version 5.43.0
> $ which tclsh
> $ ls -l /usr/bin/tclsh
> lrwxrwxrwx 1 root root 23 Nov 29 16:04 /usr/bin/tclsh -> /etc/alternatives/tclsh
> $ ls -l /etc/alternatives/tclsh
> lrwxrwxrwx 1 root root 23 Mar 29 11:05 /etc/alternatives/tclsh ->
> /usr/local/bin/tclsh8.4
>
>
> Section of jlogin that is failing:
>
> # Run commands given on the command line.
> proc run_commands { prompt command } {
>     global in_proc
>     set in_proc 1
>
>     send "set cli complete-on-space off\r"
>     expect -re $prompt  {}
>     send "set cli screen-length 0\r"
>     expect -re $prompt  {}
>
>     set commands [split $command \;]
>     set num_commands [llength $commands]
>     for {set i 0} {$i < $num_commands} { incr i} {
>         send "[lindex $commands $i]\r"
>         expect {
>             -re "^\[^\n\r *]*$prompt $" {}
>             -re "^\[^\n\r]*$prompt."    { exp_continue }
>             -re "(\r\n|\n)"                     { exp_continue }
>         }
>     }
>     send "quit\r"
>     expect {
>         "\n"                                    { exp_continue }
>         timeout                                 { catch {close}; catch {wait};
>                                                   return 0
>                                                 }
>         eof                                     { return 0 }
>     }
>     set in_proc 0
> }
>
>
> Thanks much,
> Josh
>


More information about the Rancid-discuss mailing list