question about lgform.cgi

Hopper, Faron W. faron.hopper at capgemini.com
Fri Dec 17 17:37:52 UTC 2004


John,
    Thanks for the patch.  I have applied it and it said that the patch was successful.  When I access lgform.cgi, It still doesn't give me any of routers out of the group subdir's.


I did notice an error message (in /var/log/http-error.log) that states,

    Undefined subroutine &main::strftime called at /usr/local/www/cgi-bin/lgform.cgi line 67.

It was occuring before the patch, so I don't think that has anything to do with it, though.

In your email you mentioned an assumption of --prefix=/usr/local. All I did was download the Software and extract it.  I didn't have to do a ../configure, make, etc--just move it to /usr/local

Just to make sure, I have set LG_ROUTERDB to

    $LG_ROUTERDB="/usr/local/var/rancid//router.db";

Is this the correct way to do this after the patch?

Thanks,
Faron Hopper
Capgemini
Network Engineering
Kansas City, MO 64116
816.459.5139


-----Original Message-----
From: john heasley [mailto:heas at shrubbery.net]
Sent: Friday, December 17, 2004 10:46 AM
To: Hopper, Faron W.
Cc: Andrew Partan; rancid-discuss at shrubbery.net
Subject: Re: question about lgform.cgi


Fri, Dec 17, 2004 at 10:53:20AM -0500, Hopper, Faron  W.:
>
> Andrew,
>    You are right, I see the wisdom of it now.  It would help if I were
> to look at that file, instead of directly at the cgi script.  Thank
> you for pointing that out.
>
> I have another question.  If I set the LG_ROUTERDB var to the
> following,
>
>                  #$LG_ROUTERDB="/usr/local/etc/rancid//router.db";
>                  $LG_ROUTERDB="/usr/local/var/rancid//router.db";

/usr/local/etc/rancid is an odd directory as far as rancid's autoconf is concerned.  Assuming a --prefix of /usr/local, I'd expect that path to be /usr/local/etc/router.db.

lg.conf does not provide a way to reconfigure the LOCALSTATEDIR, which is used as the directory which it searches for the list of routers.  Its value is determined by autoconf.

If LG_ROUTERDB is specified, it's value is treated solely as a file, a router.db file.  No reason that could not be treated as a directory when it is one.

Try this patch.

Index: lg.cgi.in ===================================================================
RCS file: /home/rancid/.CVS/rancid/bin/lg.cgi.in,v
retrieving revision 1.51
diff -d -u -r1.51 lg.cgi.in
--- lg.cgi.in	19 May 2004 22:59:18 -0000	1.51
+++ lg.cgi.in	17 Dec 2004 16:42:08 -0000
@@ -125,7 +125,13 @@
     local(*RTR);

     if (defined($LG_ROUTERDB)) {
-	$rtrdb = $LG_ROUTERDB;
+	# if LG_ROUTERDB is a directory, replace LOCALSTATEDIR with its value
+	# and search it for router.dbs.
+	if (-d "$LG_ROUTERDB") {
+	    $LOCALSTATEDIR = $LG_ROUTERDB;
+	} else {
+	    $rtrdb = $LG_ROUTERDB;
+	}
     } else {
 	$rtrdb = "$SYSCONFDIR/router.db";
     }
Index: lgform.cgi.in ===================================================================
RCS file: /home/rancid/.CVS/rancid/bin/lgform.cgi.in,v
retrieving revision 1.29
diff -d -u -r1.29 lgform.cgi.in
--- lgform.cgi.in	3 Sep 2004 18:41:25 -0000	1.29
+++ lgform.cgi.in	17 Dec 2004 16:42:53 -0000
@@ -116,7 +116,13 @@
     local(*RTR);

     if (defined($LG_ROUTERDB)) {
-	$rtrdb = $LG_ROUTERDB;
+	# if LG_ROUTERDB is a directory, replace LOCALSTATEDIR with its value
+	# and search it for router.dbs.
+	if (-d "$LG_ROUTERDB") {
+	    $LOCALSTATEDIR = $LG_ROUTERDB;
+	} else {
+	    $rtrdb = $LG_ROUTERDB;
+	}
     } else {
 	$rtrdb = "$SYSCONFDIR/router.db";
     }


> I don't see any of my group configured routers.  If I change the // to
> a group name it works fine, but

And, you probably have error messages in your log about the file not existing.

> only for that group.  For example,
>
>                  $LG_ROUTERDB="/usr/local/var/rancid/cg/router.db";
>
> works fine.
>
> The help for that variable states
>
>       # LG_ROUTERDB   is the router.db in rancid's router.db format, listing
>       #               the routers and their platform that should be available to
>       #               the looking glass.  if defined, the LG will use this variable
>       #               to find the router.db.  if not defined, it will look for it
>       #               at <prefix>/<sysconfdir>/router.db.  if it does not exist, it
>       #               will build the list from <prefix>/*/router.db (i.e.: the
>       #               router.db's from all your groups).  note that if you choose
>       #               this last option; the group directories and router.db files'
>       #               modes may have to be changed, depending upon the UID/GID of
>       #               the user your server (httpd) runs under, since rancid's default
>       #               mask is 007 (see etc/rancid.conf).  routers not marked 'up' are
>       #               skipped.
>       #
>
> This varilable was not defined before started to mess lg.conf, so I
> don't think that it is looking in the /usr/local/var/rancid directory
> for this information.  How do I get it to use 1) a prefix that is
> /usr/local/var/rancid, or 2) configure the variable to use the group
> subdir's under /usr/local/var/rancid?
>
> For example,
>
> /usr/local/var/rancid/group1
> /usr/local/var/rancid/group2
> /usr/local/var/rancid/group3
> /usr/local/var/rancid/group4
>     .
>     .
>     .
> etc
>
> Thank you in advance for helping a very slow learner.
> Faron Hopper
> Capgemini
> Network Engineering
> Kansas City, MO 64116
> 816.459.5139
>
>
> -----Original Message-----
> From: Andrew Partan [mailto:asp at partan.com]
> Sent: Thursday, December 16, 2004 5:12 PM
> To: Hopper, Faron W.
> Cc: rancid-discuss at shrubbery.net
> Subject: Re: question about lgform.cgi
>
>
> On Thu, Dec 16, 2004 at 04:32:14PM -0500, Hopper, Faron  W. wrote:
> > I have installed rancid on FreeBSD.  I also installed the looking
> > glass software.  When I bring up the webpage
> > http://server/cgi-bin/lgform.cgi, it loads the front end, but it is
> > not populating the routers on the page.  When I looked at the code,
> > it appeared to me that it is supposed to pull its info from the
> > rancid cvs file router.db.  Do I have to configure lgform.cgi to
> > know where these files are?  It wasn't very clear in the file what
> > needs to be done.
>
> Yes, in lg.conf, set LG_ROUTERDB to the location of router.db. See the comments in etc/lg.conf.sample.
> 	--asp
>




More information about the Rancid-discuss mailing list