[rancid] Fwd: Re: Cisco IOS versus Cisco PIX and term width 80
Jason Ellison
infotek at gmail.com
Tue Feb 10 21:23:44 UTC 2009
>>> >> I'm new to the community so I apologize for my ignorance. I saw
>>> >> another spot in the expect script where to send commands were bundled
>>> >> together. So, you are saying I need an expect $prompt to delay the
>>> >> "term width" command?
>>> >
>>> > yes, but its not a 'delay'; its waiting for the prompt and flushing it
>>> > from your input. I do not know what the other place in the code is
>>> > that you're referring to, so i cant comment on why it'd be different.
>>> >
>>>
>>> I understand that that by design expect is looking for a regexp before
>>
>> its either a regex or a glob, but that doesnt matter.
>>
>> if you send commands without waiting for the prompt you will confuse
>> yourself (your script). thats just my experience and i'm guessing thats
>> why your change doesnt work.
>>
>
> again... I will review it. I'm sure you are right. I have not played
> in expect land in over two years. You have a great project... I do
> not mean to bother you with dumb problems. I'm not being facetious.
> I think I made a mistake.
>
>>> sending. I will review my changes... Because, apparently, they do
>>> not work. Sorry to trouble you.
>>>
>>> >> I did not know about the -d debug mode. But I did read through the
>>> >> mail archives before I posted.
>>> >>
>>> >> -Jason Ellison
>>> >>
My previous patch was flawed. I was using "send" without an
"expect"... The following patch seems to work without breaking my PIX
monitoring. Thanks to John Heasley for catching the error.
-Jason Ellison
diff -uN /usr/local/src/rancid-2.3.2a9/bin/clogin bin/clogin
--- /usr/local/src/rancid-2.3.2a9/bin/clogin 2009-02-03
18:19:46.000000000 -0600
+++ bin/clogin 2009-02-10 15:16:38.000000000 -0600
@@ -610,6 +610,9 @@
set command "set logging session disable;$command"
} else {
send "terminal length 0\r"
+ expect {
+ -re "$prompt" { send -- "terminal width 80\r";}
+ }
}
# escape any parens in the prompt, such as "(enable)"
regsub -all {[)(]} $prompt {\\&} reprompt
@@ -875,6 +878,9 @@
send "set logging session disable\r"
} else {
send "terminal length 0\r"
+ expect {
+ -re "$prompt" { send -- "terminal width 80\r";}
+ }
}
expect -re $prompt {}
source $sfile
More information about the Rancid-discuss
mailing list