[rancid] Re: Adding version tags into CVS/config files

Lance Vermilion rancid at gheek.net
Tue Sep 26 08:46:26 UTC 2006


Hey all,

Anyone got an idea why this is happening?

I have this script that I was talking about working if I run it with rancid-run -r <device>. 

If I run it with rancid-run and let it spin through the devices in the devicelist I end up with the following errors.

Trying to get all of the configs.
File: /apps/rancid/var/../bin//apps/rancid/cssrancid not able to be opened:No such file or directory
File: /apps/rancid/var/../bin//apps/rancid/rancid not able to be opened:No such file or directory

When running it as rancid-run -r <device> the directory to the file is just fine.

Below is the code I added.

*** home/backup/rancid.orig     2006-09-26 01:44:19.000000000 -0700
--- bin/rancid  2006-09-26 00:49:32.000000000 -0700
*************** if (defined($ENV{"ACLSORT"}) && $ENV{"AC
*** 1823,1829 ****
--- 1823,1865 ----
      $aclsort = "";
  }
  
+ 
+ # Print Script Versions
+ # This will print out the versions of the scripts
+ # that are the core of rancid and the version of
+ # this script.
+ sub PrintScriptVersions()
+ {
+   if (defined($ENV{"PSV"}) && $ENV{"PSV"} =~ /yes/i)
+   {
+     my @files = ('rancid-fe', 'rancid-run', 'control_rancid', 'par', 'clogin', __FILE__);
+     my $File = '';
+     for $File (@files)
+     { 
+       $File =~ s/bin\///g;
+       $File = $ENV{"BASEDIR"} . '/../bin/' . $File;
+       open(FILE, "$File") or warn "File: $File not able to be opened:$!\n";
+       while (<FILE>)
+       {
+         if ( /^##\s\$Id:\s(.*)\s(\d+){4}\/.*\sExp\s\$$/ )
+         {
+           my ($script, $version) = split(/,/, $1);
+           chomp ($version, $script);
+           ProcessHistory("","","","!RANCID-SCRIPT-TYPE: [$script ($version)]\n");
+         }
+       }
+       close (FILE);
+     }
+     ProcessHistory("","","","!\n");
+   }
+   else
+   {
+     ProcessHistory("","","","!\n");
+   }
+ }
+ 
  ProcessHistory("","","","!RANCID-CONTENT-TYPE: cisco\n");
+ PrintScriptVersions();
  ProcessHistory("COMMENTS","keysort","B0","!\n");
  ProcessHistory("COMMENTS","keysort","D0","!\n");
  ProcessHistory("COMMENTS","keysort","F0","!\n");



-- 

-Lance <rancid at gheek.net>

On Mon, Sep 25, 2006 at 05:31:09PM -0700, john heasley wrote:
> Mon, Sep 25, 2006 at 02:39:00PM -0700, Lance Vermilion:
> > John,
> > 
> > Are you saying that @VERSION@ will return the version of rancid?
> 
> It should be replaced by autoconf with the release version, coming from
> include/version.h.in.
> 
> > I am interested in knowing what the other core script versions are as well.
> > Where is the @VERSION@ variable stored?
> > Are the values in VERSION $Id: scriptname,v version?
> > 
> > -- 
> > 
> > -Lance <lance at gheek.net>
> > 
> > 
> > On Mon, Sep 25, 2006 at 02:27:13PM -0700, john heasley wrote:
> > > To me, the more interesting bit is just the release, not the CVS revision.
> > > That is simple as replacing @VERSION at .  Also, hpuifilter -v will report
> > > the version.
> > > 
> > > Mon, Sep 25, 2006 at 05:00:28PM -0400, Burton Windle:
> > > > 
> > > > 
> > > > On Mon, 25 Sep 2006, Lance Vermilion wrote:
> > > > 
> > > > > Hey all,
> > > > >
> > > > > I have seen the question "What version of (rancid/clogin/etc) am I 
> > > > > running?" come up a few different times. I know that each script has its 
> > > > > own version etc. It would be nice to have something like what is below 
> > > > > add at the top of each config. This would make it extremely clear what 
> > > > > was used to collect the configs and what versions are being used.
> > > > >
> > > > 
> > > > Speaking from experience as one of those people who has recently asked 
> > > > that same question...
> > > > 
> > > > I checked the rancid script for a -v, -V, or --version argument first, 
> > > > then went searching the text of the script for a (non-CVS) version. I 
> > > > never thought of checking the CVS repo for the RANCID version; having an 
> > > > argument to the program (or in this case, the script) and have it spit out 
> > > > the version would be, IMHO, very handy (and more in-line with other Unixy 
> > > > apps, so more likey to be stumbled upon by the typical admin).
> > > > 
> > > > Having to dig in the CVS repo is, I would think, unlikey to get found 
> > > > without some handholding, be it FAQ or list.
> > > > 
> > > > 
> > > > -- 
> > > > Burton Windle                           bwindle at fint.org
> > > > 
> > > > _______________________________________________
> > > > Rancid-discuss mailing list
> > > > Rancid-discuss at shrubbery.net
> > > > http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
> > > _______________________________________________
> > > Rancid-discuss mailing list
> > > Rancid-discuss at shrubbery.net
> > > http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
> > 





More information about the Rancid-discuss mailing list