Rancid: Delete/Remove a File or Directory from SVN Repository

Rancid is fantastic tool to backup configuration and track configuration changes.You can use CSV or SVN to manage configuration repositories.

One issue is that if you need to delete a device or directory from Rancid, it’s not that straight forward.

Essentially if you are using CSV as Rancid repository there is no way to delete an entry, but using SVN below commands will help you.

First of all find the base directory used by Rancid:

#cat etc/rancid.conf | grep BASEDIR=
BASEDIR=/home/rancid/var; export BASEDIR

Then find the SVN Directory (still named as CVSROOT):

#cat etc/rancid.conf | grep CVSROOT=
CVSROOT=$BASEDIR/SVN; export CVSROOT

So your SVN Working Directory will be:

/home/rancid/var/SVN

List the repository content:

#svn ls file:///home/rancid/var/SVN
VIC/
NSW/
SA/
QLD/

List a directory content:

#svn ls file:///home/rancid/var/SVN/VIC
vicrtr01
vicrtr02
vicsw01
vicsw02

Delete a file from the repository:

#svn rm file:///home/rancid/var/SVN/VIC/vicrtr01 --message "Deleting"

Delete a directory completely from the repository:

svn rm file:///home/rancid/var/SVN/VIC --message "Deleting"

You can verify by listing the repository again:

#svn ls file:///home/rancid/var/SVN
NSW/
SA/
QLD/

CAUTION: When you remove a device from repository, the config files will be deleted too. So if you need your config file take a backup before removing the device from repository.

Advertisements
Posted in Cisco
One comment on “Rancid: Delete/Remove a File or Directory from SVN Repository

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: