[rancid] remote subversion 'hack' + small commit remark patch

Tom Duijf tom.duijf at gmail.com
Tue Jun 3 16:00:01 UTC 2008

Hi all,

I search the list archived for a way to use a existing remote
subversion repository, i couldn't find a solution.
So, for those interested here is a small howto in order to achieve this.
Besides this howto, at the end of the mail, i wrote a small
description of the 2 patch files attached to this mail. It adds a
feature where you can prefix all repository checkin comments using a
config file variable. Feature only applies if you actually add a
directive in the config file.

## Remote  / existing subversion repository usage.
This short howto only applies to subversion, i never use cvs so i
don't know if and how this would apply to cvs.
Rancid normally creates a local svn/cvs repos and checks out working
copies for each list_group. This is done by rancid-cvs when you are
initially setting up rancid or add list_groups to the config file.
This is also the _only_ command which uses the repository itself, all
other actions / mutations are done on the working copy.
Taking the above into account, you can checkout a working copy from
any subversion repository (local or remote, svn://, http(s)://, ssh,
whatever). The location a subversion repository is contained in the
metadata of working copies.
There are some things to take into account:
- You need to cache the subversion credentials (enable this in
~/.subversion/config )
- You chose to either make a working copy per 'list_group' or make the
entire $WORKDIR a working copy. Most importantly, this must be checked
in and updated _before_ you run rancid-run. (you might have to
svn:ignore some files/dirs if you make $WORKDIR a working copy, such
as logs).
- If you add a new list_group, you need to touch router.db and create
the config/ dir. The rest of the files are auto-created by rancid-run.
- Never run rancid-cvs, as this will screw up everything :)

I have rancid running with 2 groups (a working copy per group dir)
using a larger, more generic configuration store on a remote
subversion instance (via http+mod_dav+mod_dav_svnauthz). Works like a
charm :)

## Patches
One of the drawbacks of the current rancid commits (regardless of svn
or cvs), is that the commit remarks (messages) are hard coded in the
scripts and don't really describe much ('updates', 'new router', etc).
Specially in the above situation, where the rancid tree is part of a
larger repository, it's nice to have little more freedom in commit
The attached patches are for control_rancid and rancid-cvs which
prefix the commit remarks with a variable from the config file.
The reason i didn't include a space (check patch files) between the
prefix and the existing message is that i didn't want this to be
mandatory. If you don't define the variable in the config file,
nothing will change.

As the config file is sourced into the script files, you can actually
use `` or global variables.
Example of the new config file variable:
## If you use this, always end your comment with a space!
RCSREMARKS="AUTOCOMMIT -- Rancid config backup
Comitted on: `date +%Y/%m/%d-%H:%M:%S`
Comitted by: ${0}
Action: "; export RCSREMARKS

Extra note1.
It would be nice if rancid did an svn/cvs update before using the
working copy. This way, for example, router.db could be updated
through the repository, and it would prevent conflicts in general.
I might submit a patch for this later as i need to dig deeper into the scripts.

Extra note2.
I think there's a bug in the alteon parser. I am getting a diff of 1
line each run, which i think is caused by the fact that we have 2
alteons in sync mode. I need to look further into this and hopefully
commit a patch for this as well.

Kind regards,
Tom Duijf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: control_rancid.patch
Type: unknown/unknown
Size: 1099 bytes
Desc: not available
Url : http://www.shrubbery.net/pipermail/rancid-discuss/attachments/20080603/a54eb191/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rancid-cvs.patch
Type: unknown/unknown
Size: 493 bytes
Desc: not available
Url : http://www.shrubbery.net/pipermail/rancid-discuss/attachments/20080603/a54eb191/attachment-0001.bin 

More information about the Rancid-discuss mailing list