Discussion:
[rancid] Prompt detection eats exit, clean run not found
Brandon Ewing
2018-01-05 15:40:28 UTC
Permalink
It appears that several modules for rancid rely on non-prompt exits from
specific commands (IE, "end" at the end of WriteTerm) to ensure that the
"exit" string is available for inloop to detect to mark a clean run.

Devices that do not have an end marker, or custom types that do not have
WriteTerm last, have to fall back on prompt detection, which in most
modules, also swallows the "exit" string.

It appears this is fixed in aeos.pm with a GOTO CMD statement, but that
doesn't appear standard in other modules.

You can reproduce this error by defining a custom type:

test;script;rancid -t test
test;login;clogin
test;module;ios
test;inloop;ios::inloop
test;command;ios::WriteTerm;show running-config
test;command;ios::ShowVersion;show version

rancid -dt test ios
loadtype: device type test
loadtype: found device type test in /home/bewing/etc/rancid.types.conf
executing clogin -t 90 -c"show running-config;show version" ios
PROMPT MATCH: ios#
HIT COMMAND:ios#show running-config
In WriteTerm: ios#show running-config
HIT COMMAND:ios#show version
In ShowVersion: ios#show version
TYPE = WS-C3850-48U
ios: End of run not found
ios: clean_run is false
!BOOTLDR: Version 3.58, RELEASE SOFTWARE (P)
--
Brandon Ewing (***@warningg.com)
heasley
2018-01-05 18:08:43 UTC
Permalink
Post by Brandon Ewing
It appears that several modules for rancid rely on non-prompt exits from
specific commands (IE, "end" at the end of WriteTerm) to ensure that the
"exit" string is available for inloop to detect to mark a clean run.
Devices that do not have an end marker, or custom types that do not have
WriteTerm last, have to fall back on prompt detection, which in most
modules, also swallows the "exit" string.
It appears this is fixed in aeos.pm with a GOTO CMD statement, but that
doesn't appear standard in other modules.
right, if $_ has a prompt, evaluate it, dont read another line.

if (defined($prompt)) {
if (/$prompt/) {
goto CMD;
}
}
Post by Brandon Ewing
test;script;rancid -t test
test;login;clogin
test;module;ios
test;inloop;ios::inloop
test;command;ios::WriteTerm;show running-config
test;command;ios::ShowVersion;show version
rancid -dt test ios
loadtype: device type test
loadtype: found device type test in /home/bewing/etc/rancid.types.conf
executing clogin -t 90 -c"show running-config;show version" ios
PROMPT MATCH: ios#
HIT COMMAND:ios#show running-config
In WriteTerm: ios#show running-config
HIT COMMAND:ios#show version
In ShowVersion: ios#show version
TYPE = WS-C3850-48U
thats ios, it should have and eng marker; if it does not, then its broken.
and, ios devices and others do this from time to time; they leak memory
until they have so little free that they can not produce a full human-
display config, then they just truncate it. others produce no output, but
indicate success or lack an error. hence, the checks.
Post by Brandon Ewing
ios: End of run not found
ios: clean_run is false
!BOOTLDR: Version 3.58, RELEASE SOFTWARE (P)
--
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
Loading...