[rancid] Re: expect script help

Brian Lam blam at rockyou.com
Tue Feb 2 10:55:39 UTC 2010


i found the debug flag.  here's the output during the loop:
(i will try to trace it down in the code and see if i can set a condition
for this...)

r204-sw1>
expect: does "          ^\r\n% Invalid input detected at '^'
marker.\r\n\r\nr204-sw1>" (spawn_id exp6) match regular expression "^[^\n\r
*]*r204-sw1([^#>\r\n]+)?[#>](\([^)\r\n]+\))?"? no
"The system has unsaved changes"? no
"Would you like to save them now"? no
"(Profile|Configuration) changes have occurred.*"? no
"Do you wish to save your configuration changes"? no
"[\n\r]+"? yes
expect: set expect_out(0,string) "\r\n"
expect: set expect_out(spawn_id) "exp6"
expect: set expect_out(buffer) "          ^\r\n"
expect: continuing expect

expect: does "% Invalid input detected at '^' marker.\r\n\r\nr204-sw1>"
(spawn_id exp6) match regular expression "^[^\n\r
*]*r204-sw1([^#>\r\n]+)?[#>](\([^)\r\n]+\))?"? no
"The system has unsaved changes"? no
"Would you like to save them now"? no
"(Profile|Configuration) changes have occurred.*"? no
"Do you wish to save your configuration changes"? no
"[\n\r]+"? yes
expect: set expect_out(0,string) "\r\n\r\n"
expect: set expect_out(spawn_id) "exp6"
expect: set expect_out(buffer) "% Invalid input detected at '^'
marker.\r\n\r\n"
expect: continuing expect

expect: does "r204-sw1>" (spawn_id exp6) match regular expression "^[^\n\r
*]*r204-sw1([^#>\r\n]+)?[#>](\([^)\r\n]+\))?"? yes
expect: set expect_out(0,string) "r204-sw1>"
expect: set expect_out(spawn_id) "exp6"
expect: set expect_out(buffer) "r204-sw1>"
send: sending "exit\r" to { exp6 human_write: avg_arr=0.400000/0.400000
1/shape=1.428571  min=0.300000  max=5.000000


sighandler: handling signal(2)
async event handler: Tcl_Eval(exit 130)



write() failed to write anything - will sleep(1) and retry...
EQX root at itops1a:/usr/local/rancid/bin#




On Tue, Feb 2, 2010 at 2:40 AM, Brian Lam <blam at rockyou.com> wrote:

>
>
> 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
>



-- 
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/0516ba97/attachment.html 


More information about the Rancid-discuss mailing list