[rancid] Re: expect script help

Brian Lam blam at rockyou.com
Tue Feb 2 10:40:54 UTC 2010


On Fri, Jan 29, 2010 at 6:00 AM, Martin Barry <marty at supine.com> wrote:

> $quoted_author = "Brian Lam" ;
> >
> > The expect / python script /usr/local/rancid/bin/clogin was looping
> because
> > my router doesn't like 'exit' and prefer 'quit'.
>
> You can either modify the following to match the 'force10' platform (does
> the newer one accept quit?)
>
>

the new f10 version accepts 'quit'




> # line 678
>    if { [ string compare "extreme" "$platform" ] } {
>        send -h "exit\r"
>    } else {
>        send -h "quit\r"
>    }
>
>


my version of rancid is 2.3.2

per your recommendation, here's the diff:

EQX root at itops1a:/usr/local/rancid/bin# diff clogin clogin.original
662,664c662
<     if { [ string compare "force10" "$platform" ] } {
<        send -h "quit\r"
<     } elseif { [ string compare "extreme" "$platform" ] } {
---
>     if { [ string compare "extreme" "$platform" ] } {
EQX root at itops1a:/usr/local/rancid/bin#

it's a case of fixing one thing and another breaks...

it looks like it's not looping anymore but it's not updating any of the f10
switches (the previous working f10 are not updated either). rancid log shows
the following for all force10 router:
(maybe because the output is different now, rancid end regex doesn't work
anymore?)

=====================================
Getting missed routers: round 1.
r103: End of run not found
end
r103-2: End of run not found
end
r205-sw1: End of run not found
end
ec1: End of run not found
end
ec2: End of run not found
end
r304: End of run not found
end
r304-2: End of run not found
end
=====================================





> or you could add a stanza in the next section to catch the error thrown
> when
> sending 'exit' to old force10.
>
>


maybe i will target the stanza instead and have better luck.  the loop
output is below.  the first 'exit' works but the 2nd on throws an error '%
Invalid input detected at '^' marker.'

could you help point me to the right place where i can write an expect
regexp to capture this error and deal with it?  many thanks.  spend many hr
pulling my hair / debugging!  :p  btw, is their a debug flag that i can set
to get more debug outputs?



(looping output)

 interface vlan  1
 exit



exit
end

r204-sw1#exit

r204-sw1>exit
          ^
% Invalid input detected at '^' marker.

r204-sw1>exit
          ^
% Invalid input detected at '^' marker.

r204-sw1>exit
          ^
% Invalid input detected at '^' marker.

r204-sw1>exit
          ^

(looping...)




> cheers
> Marty
> _______________________________________________
> Rancid-discuss mailing list
> Rancid-discuss at shrubbery.net
> http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
>



-- 
Brian Lam | IT/Operations | Rockyou, Inc. | Phone: 408-425-9801 | AIM:
brianclam2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.shrubbery.net/pipermail/rancid-discuss/attachments/20100202/46a79a88/attachment.html 


More information about the Rancid-discuss mailing list