Mailing List Archive

trying to add Cisco clustering support to rancid -- almost do ne
> -----Original Message-----
> From: Andrew Partan [mailto:asp at partan.com]
> Sent: Friday, May 13, 2005 2:30 PM
> To: Chris Stave
> Cc: Rancid Discussion List
> Subject: Re: trying to add Cisco clustering support to rancid
(snip)
> These embedded 'exit' commands are really going to mess things up.
> rancid's control logic is really very simple right now; all that
> it knows is that is runs a series of commands and that the last
> command is 'exit', and that when it sees 'exit', its done & its an
> error if there are commands left over.


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.

Aaron
------------------
Aaron Gee-Clough
DNST/CIT/NEB/NSS
Contractor. Geek.
trying to add Cisco clustering support to rancid -- almost do ne [ In reply to ]
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