[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Help with Apache::Admin::Config Requested

From: "Olivier Poitrey" <olivier@pas-tres.net>
> > ... obj->add_blank() doens't add the blank lines...
> > ... conf->save doesn't write the configuration to the file...
> Please tell me more about the version of AAC you are using, and cut
> and past me some code. I can't replicate the glitche.

I resolved the configuration file update problem by going back to specifying
the file name. I had tried using "new Apache::Admin::Config \*HANDLE" (with
version 0.55-1) so I could 'flock' the file to prevent possible conflicts
with parallel script execution. Foregoing file handles allows me to update
the configuration file. The blank lines are more for human readability
should the file need to be manually revised later, but they are currently
still not updating. The code to create the virtual host is as follows:

      $vhost = $conf->add_blank('-onbottom');
      $vhost = $conf->add_section("VirtualHost",$weburls);
      # Configure primary directives
      $hostname = $vhost->add_directive('ServerName',$webname);
      $hostadmin = $vhost->add_directive('ServerAdmin',$webadmin);
      $hostlog = $vhost->add_directive('CustomLog',$logfile);
      $hosterr = $vhost->add_directive('ErrorLog',$errfile);
      $hostroot= $vhost->add_directive('DocumentRoot',$docroot);
      # Add web site bandwidth limitations
      $modthrottle = $vhost->add_section('IfModule','mod_throttle.c');
      $hostlimit = $modthrottle->add_directive('ThrottlePolicy',$weblimit);

      $location = $modthrottle->add_section('Location','/throttle-me');
      $handler = $location->add_directive('SetHandler','throttle-me');
      # Save new web site configuration
      unless ($conf->save) { $errmsg = $conf->error };
      if ($DEBUG>1) { print "Virtual host $opt{'v'}\n".$conf->dump_raw; }

As I said, changing back to specifying the file name fixed the problem of
saving the
new configuration, but it doesn't include blank lines to make it human
readable. I am
not that concerned with this issue just now so much as how to lock file

> ... Finally, print the error
> string at the failure like this :
>        $conf->save() or die print $conf->error();

Actually, I was using the following but it didn't report any errors.

    unless ($conf->save) { $errmsg = $conf->error };
if ($errmsg) { ShowError($errmsg); }

Reply to: