[rancid] [patch] unexpected command - "write term" in newer Foundry devices

heasley heas at shrubbery.net
Mon Jul 11 21:46:33 UTC 2016


Mon, Jul 11, 2016 at 11:12:54AM +0200, Erik Muller:
> Since updating from rancid 2.3.x to 3.4.1, I found a few Brocade/Foundry devices that stopped collecting backups properly.  It looks like in Ironware 5.5 for MLX family devices, they stopped supporting "write term".  This resulted in rancid runs seeing the error message as an unexpected command, since the error string looks a lot like a command prompt.  The below patch fixes this for me, and seems to have no negative side effects on other flavors of foundry boxen.
> -e
> 
> 
> erikm at Metis:~ [00:19 - 551]$ diff -Naur /opt/local/lib/rancid/foundry.pm.bak /opt/local/lib/rancid/foundry.pm
> --- /opt/local/lib/rancid/foundry.pm.bak        2016-07-10 22:25:16.000000000 +0200
> +++ /opt/local/lib/rancid/foundry.pm    2016-07-11 00:19:23.000000000 +0200
> @@ -100,6 +100,12 @@
>         }
>         while (/[>#]\s*($cmds_regexp)\s*$/) {
>             $cmd = $1;
> +           # Some devices can give an error that looks a lot like a prompt
> +           # for deprecated commands like "write term".  Ignore that.
> +           if (/^Invalid input -> /) {
> +               print STDERR ("Ignoring invalid command: $cmd\n") if ($debug);
> +               last;
> +           }

This should be handled by the existing code.  There must be another root
cause.  Perhaps you would send the output of the following command to me?

eval `rancid -t foundry -C cer.r8.atl` > output 2>&1

>             if (!defined($prompt)) {
>                 $prompt = ($_ =~ /^([^#]+#)/)[0];
>                 $prompt =~ s/([][}{)(\\])/\\$1/g;
> 
> 
> 
> Example output from a failing device:
> 
> erikm at Metis:/opt/local/var/rancid/logs [20:27 - 522]$ flogin -t 90 -c"show version;write term" cer.r8.atl
> spawn ssh -c 3des -x -l xxxx cer.r8.atl
> Password:
> SSH at er1-pp.c8.56M>enable
> User Name:xxxxx
> Password:
> SSH at er1-pp.c8.56M#
> SSH at er1-pp.c8.56M#skip-page-display
> Invalid input -> skip-page-display
> Type ? for a list
> SSH at er1-pp.c8.56M#terminal length 0
> SSH at er1-pp.c8.56M#show version
> System: NetIron CER (Serial #: xxxxx,  Part #: 40-1000859-12)
> ...
> IronWare : Version 5.5.0cT183 Copyright (c) 1996-2013 Brocade Communications Systems, Inc.
> Compiled on Jul  8 2013 at 14:53:26 labeled as ce05500c
> ...
> SSH at er1-pp.c8.56M#write term
> Invalid input -> write term
> Type ? for a list
> SSH at er1-pp.c8.56M#exit
> SSH at er1-pp.c8.56M>exitConnection to 10.10.50.243 closed.
> 
> _______________________________________________
> Rancid-discuss mailing list
> Rancid-discuss at shrubbery.net
> http://www.shrubbery.net/mailman/listinfo/rancid-discuss



More information about the Rancid-discuss mailing list