trying to add Cisco clustering support to rancid -- almost do ne
Andrew Partan
asp at partan.com
Fri May 13 21:32:50 UTC 2005
On Fri, May 13, 2005 at 04:58:06PM -0400, Gee-clough, Aaron (NIH/CIT) wrote:
> As a data point, I've used Rancid with embedded "exits" with the -c command
> and a bunch of semi-colons (like clogin -c "conf t; enable password
> blah;exit;write mem") with no problem. Perhaps it's parsing the -c options
> differently than its internal control logic...dunno. So far, though, I've
> found that as long as the end result of my string of commands is enable mode
> (not configure), rancid just handles it.
[Warning: rancid refers to the entire package and to one of the
programs in the package; here I'm taking about the program in the
package.]
clogin -c "cmd;exit;cmd;exit;cmd" is not a problem.
The problem is trying to do it in bin/rancid.
[rancid internally calls clogin -c with a series of commands.]
Look at bin/rancid and %commands and @commands. %commands takes a
command and a subroutine to handle the output of that command.
@commands is just the list of commands.
Adding "exit" and a no-op subroutine to handle exit should be no
problem, except that I think it will mess up the control loop - see
the control loop that starts with TOP:.
After rancid has run & parsed all of the commands in %commands/@commands,
it looks for "exit" to make sure that everything has run correctly.
I think that the control loop will get messed up if you try to have
"exit" be a 'normal' command and the end-of-commands marker.
Also you can't have repeated commands in %commands/@commands; I
just tried modifying %commands/@commands to run show version twice
and rancid died with:
found unexpected command - "show version"
So I think that if you want to have "exit" in the commands list,
and to use "exit" as the end-of-commands marker, and to have "exit"
in the commands list more than once, then the control loop in rancid
will have to be rewritten.
--asp
More information about the Rancid-discuss
mailing list