Discussion:
[rancid] term width changes
Lee
2010-10-06 18:27:19 UTC
Permalink
Maybe this falls into the "don't do that category", but I've been
doing rancid-run interactively as well as from cron & getting ~3MB
emails because the line width changes when run interactively vs.
started from crontab. For example:

- !VLAN: Gi1/0/45,
Gi1/0/46, Gi1/0/47
- !VLAN: Gi1/0/48,
Gi1/0/49, Gi1/0/50
- !VLAN: Gi1/0/51
+ !VLAN: 1 default active Gi1/0/1,
Gi1/0/2, Gi1/0/9, Gi1/0/10, Gi1/0/11, Gi1/0/14, Gi1/0/15, Gi1/0/16
+ !VLAN: Gi1/0/17,
Gi1/0/18, Gi1/0/19, Gi1/0/20, Gi1/0/21, Gi1/0/22, Gi1/0/23, Gi1/0/24
+ !VLAN: Gi1/0/25,
Gi1/0/26, Gi1/0/27, Gi1/0/28, Gi1/0/29, Gi1/0/30, Gi1/0/31, Gi1/0/32

This fixes the problem for me:

diff -U 6 rancid-2.3.5/bin/clogin ~rancid/bin/clogin
--- rancid-2.3.5/bin/clogin 2010-09-23 10:58:12.000000000 -0400
+++ ~/rancid/bin/clogin 2010-10-06 12:18:53.000000000 -0400
@@ -600,16 +604,22 @@
send "set length 0\r"
# This is ugly, but reduces code duplication, allowing the
# subsequent expects to handle everything as normal.
set command "set logging session disable;$command"
} else {
send "terminal length 0\r"
+ expect {
+ -re $prompt {}
+ -re "\[\n\r]+" { exp_continue }
+ }
+ send "terminal width 132\r" ;# --LR--
}
# match cisco config mode prompts too, such as router(config-if)#,
# but catalyst does not change in this fashion.
expect {
-re $reprompt {}
-re "\[\n\r]+" { exp_continue }

Lee

Loading...