[rancid] Trying to backup InfiNet Devices
heasley
heas at shrubbery.net
Wed Jan 12 22:39:14 UTC 2022
Wed, Jan 12, 2022 at 09:40:08PM +0000, Daniel Thomas:
> In order to get the "./rancid -d -t <type>" to work correctly for me I had
> to edit the
> following two lines in "rancid.types.conf":
> infinet;script;rancid -t infinet
> infinet;login;infilogin
> So that they read as:
> infinet;script;./rancid -t infinet
> infinet;login;/usr/local/rancid/bin/infilogin
Assuming that directory is in rancid.conf:PATH, it does not have to be
a FQPN here. it can be though, obviously.
> This then meant that my <device>.new and <device>.raw files would populate
> and I
> was able to troubleshoot the issues that were happening in inLoop. The big
> problem
> that I was facing was that the "$" in the hostname was being read as a
> variable in PERL.
>
> As the RANCID SSH was always the 1st connection the hostname had "$1" at the
> end and so PERL was looking at the contents of $1 - which threw off all the
> prompt
> matches. In trying to remove that (with my poor PERL skills) I stumbled
> over
> a not so elegant solution of using:
> tr/\$/\\/;
> In each of the subroutines in the infinet.pm file (just after each
> occurence of "tr/\015//d;")
> This way the hostname was viewed consistently throughout the script.
Not sure that I follow, but if it works in all the permutation of the
prompt, great. I suspect this might be the problem with your 2 failing
devices. maybe discard the tail of the prompt, escape any regex atoms,
and append the aforementioned regex like:
if (!defined($prompt)) {
$prompt = ($_ =~ /^([^#>$]+)(\$\d+)?[#>]/)[0];
$prompt =~ s/([][}{)(+\\])/\\$1/g;
$prompt .= "(\$\d+)?[#>]";
print STDERR ("PROMPT MATCH: $prompt\n") if ($debug);
}
prost
More information about the Rancid-discuss
mailing list