[rancid] RANCID fails if a 'write term' fails after a 'show run' succeeds
David Luyer - RANCID
david+rancid at luyer.net
Thu Jun 28 18:20:54 UTC 2007
G'day,
I noticed recently that RANCID fails when it attempts to back up
the configuration for a Cisco where it is permitted to do a
"show run" but not permitted to do a "write term". Since in this
case it wouldn't actually use the output of the "write term" so it
should ignore this and succeed.
The fix is trivial, move the 'return(0)' up a few lines.
Here's a patch (fixing other related cases too):
--- rancid.in.orig 2007-06-28 10:42:15.000000000 -0700
+++ rancid.in 2007-06-28 10:43:19.000000000 -0700
@@ -155,8 +155,8 @@
next if (/^(\s*|\s*$cmd\s*)$/);
return(1) if /Line has invalid autocommand /;
return(1) if /(Invalid input detected|Type help or )/;
- return(-1) if (/command authorization failed/i);
return(0) if ($found_version); # Only do this routine once
+ return(-1) if (/command authorization failed/i);
# the pager can not be disabled per-session on the PIX
if (/^(<-+ More -+>)/) {
my($len) = length($1);
@@ -480,8 +480,8 @@
#return(1) if ($type !~ /^7/);
return(1) if /Line has invalid autocommand /;
return(1) if /(Invalid input detected|Type help or )/;
- return(-1) if (/command authorization failed/i);
return(0) if ($found_env); # Only do this routine once
+ return(-1) if (/command authorization failed/i);
# the pager can not be disabled per-session on the PIX
if (/^(<-+ More -+>)/) {
my($len) = length($1);
@@ -939,8 +939,8 @@
# return(1) if ($type !~ /^(12[40]|720|36|26)/);
return(1) if /Line has invalid autocommand /;
return(1) if /(Invalid input detected|Type help or )/;
- return(-1) if (/command authorization failed/i);
return(0) if ($found_diag); # Only do this routine once
+ return(-1) if (/command authorization failed/i);
/^$/ && next;
# the pager can not be disabled per-session on the PIX
if (/^(<-+ More -+>)/) {
@@ -1411,6 +1411,7 @@
last if (/^$prompt/);
return(1) if /Line has invalid autocommand /;
return(1) if (/(Invalid input detected|Type help or )/i);
+ return(0) if ($found_end); # Only do this routine once
return(-1) if (/command authorization failed/i);
# the pager can not be disabled per-session on the PIX
if (/^(<-+ More -+>)/) {
@@ -1419,7 +1420,6 @@
}
/Non-Volatile memory is in use/ && return(-1); # NvRAM is locked
- return(0) if ($found_end); # Only do this routine once
$linecnt++;
$lineauto = 0 if (/^[^ ]/);
# skip the crap
David.
More information about the Rancid-discuss
mailing list