Discussion:
[rancid] Revision Searches
Matthew Goeres
2017-10-19 17:13:23 UTC
Permalink
Looking for ideas on how I can search back revisions on multiple devices.

Example: I have a folder with around 200 devices in it. I would like to
look back at say the last 5 revisions for all devices and grep those
changes for something like a zone change. Anyone had some ideas on how to
do this with CVS?
Gauthier, Chris
2017-10-19 17:48:10 UTC
Permalink
I used WebCVS previously. That allowed me to compare versions nicely. That may not be exactly what you’re looking for, though.

Conceptually, it’s possible to script it with Perl or something like that. In the discussion below, I refer to X and Y, where X is the base version and Version Y is version (X-5).

Write a script that pulls version X and saves it as a unique filename (vX.txt). Do the same for version Y (vY.txt). Then, do a diff of versions X and Y with the output going to diffXY.txt. Grep that output for the code relevant to a zone change or other configuration change you are looking for. Lastly, the script could send an email, with the file diffXY.txt attached, to a designated email address. You could even script this to run just after rancid finishes a poll, but that would take more scripting.

Just a few thoughts.

--Chris



Chris GauthierSenior Network Engineer | comScore, Inc.
o +1 503-331-***@comscore.com
317 SW Alder Street, Suite 700 | Portland | OR97204
............................................................................................................................................................................................................................

From: Rancid-discuss <rancid-discuss-***@shrubbery.net> on behalf of Matthew Goeres <***@gmail.com>
Date: Thursday, October 19, 2017 at 10:38 AM
To: "rancid-***@shrubbery.net" <rancid-***@shrubbery.net>
Subject: [rancid] Revision Searches

Looking for ideas on how I can search back revisions on multiple devices.

Example: I have a folder with around 200 devices in it. I would like to look back at say the last 5 revisions for all devices and grep those changes for something like a zone change. Anyone had some ideas on how to do this with CVS?
heasley
2017-10-19 18:38:50 UTC
Permalink
Post by Gauthier, Chris
Write a script that pulls version X and saves it as a unique filename (vX.txt). Do the same for version Y (vY.txt). Then, do a diff of versions X and Y with the output going to diffXY.txt. Grep that output for the code relevant to a zone change or other configuration change you are looking for. Lastly, the script could send an email, with the file diffXY.txt attached, to a designated email address. You could even script this to run just after rancid finishes a poll, but that would take more scripting.
also see cvs {r}annotate and options to cvs log
Lee
2017-10-19 21:37:15 UTC
Permalink
Post by Matthew Goeres
Looking for ideas on how I can search back revisions on multiple devices.
Example: I have a folder with around 200 devices in it. I would like to
look back at say the last 5 revisions for all devices and grep those
changes for something like a zone change. Anyone had some ideas on how to
do this with CVS?
Would something like
cvs diff -D "2 months ago" -U 5 devName
be close enuf?

Lee
Doug Hughes
2017-10-20 00:42:39 UTC
Permalink
It's been a while since I've used cvs, but here's what I'd do with
subversion, which is not hugely different.

1) co the config tree into a temporary directory (here using svn co or
similar)

2) cd to the configs directory

3) look at the log history on one of the files and find the time frame
I'm looking for. Here, we're relying on the fact that rancid is running
a bulk check-in at once for all of the files, so they all have the same
version number at the same time of run.

4) svn update -r<version> * - that brings out all the files at that same
version number (e.g. whatever that version is from 5 revs ago)

5) run grep on *


(there's always the option of converting your cvs to subversion, though
I'm not sure if it didn't keep the revs the same if that would translate
similarly)
Post by Lee
Post by Matthew Goeres
Looking for ideas on how I can search back revisions on multiple devices.
Example: I have a folder with around 200 devices in it. I would like to
look back at say the last 5 revisions for all devices and grep those
changes for something like a zone change. Anyone had some ideas on how to
do this with CVS?
Would something like
cvs diff -D "2 months ago" -U 5 devName
be close enuf?
Lee
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
--
Doug Hughes
Keystone NAP
Fairless Hills, PA
1.844.KEYBLOCK (539.2562)
Loading...