[interchange-cvs] interchange - jon modified lib/Vend/Config.pm
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Thu Mar 2 02:12:28 EST 2006
User: jon
Date: 2006-03-02 07:12:28 GMT
Modified: lib/Vend Config.pm
Log:
Improve support for relocating various Interchange-generated files to
relative paths and add catalog-level RunDir directive.
For example, to move all such files into a var/ hierarchy in traditional
Unix fashion:
In interchange.cfg:
RunDir var/run
ErrorFile var/log/error.log
PIDFile var/run/interchange.pid
SocketFile var/run/socket
IPCsocket var/run/socket.ipc
In catalog.cfg:
RunDir var/run
LogFile var/log/misc.log
ErrorFile var/log/error.log
SessionDatabase var/session
ScratchDir var/tmp
Still to be dealt with is a chicken-and-egg problem with the global RunDir,
where the interchange.cfg RunDir setting isn't early enough to cover all
settings.
Revision Changes Path
2.198 +22 -13 interchange/lib/Vend/Config.pm
rev 2.198, prev_rev 2.197
Index: Config.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Config.pm,v
retrieving revision 2.197
retrieving revision 2.198
diff -u -u -r2.197 -r2.198
--- Config.pm 23 Feb 2006 03:34:53 -0000 2.197
+++ Config.pm 2 Mar 2006 07:12:27 -0000 2.198
@@ -1,6 +1,6 @@
# Vend::Config - Configure Interchange
#
-# $Id: Config.pm,v 2.197 2006/02/23 03:34:53 jon Exp $
+# $Id: Config.pm,v 2.198 2006/03/02 07:12:27 jon Exp $
#
# Copyright (C) 2002-2006 Interchange Development Group
# Copyright (C) 1996-2002 Red Hat, Inc.
@@ -54,7 +54,7 @@
use Vend::Data;
use Vend::Cron;
-$VERSION = substr(q$Revision: 2.197 $, 10);
+$VERSION = substr(q$Revision: 2.198 $, 10);
my %CDname;
my %CPname;
@@ -386,8 +386,8 @@
['ConfigDir', undef, 'etc/lib'],
['FeatureDir', 'root_dir', 'features'],
['ConfigDatabase', 'config_db', ''],
- ['ConfigAllBefore', 'array', "$Global::VendRoot/catalog_before.cfg"],
- ['ConfigAllAfter', 'array', "$Global::VendRoot/catalog_after.cfg"],
+ ['ConfigAllBefore', 'root_dir_array', 'catalog_before.cfg'],
+ ['ConfigAllAfter', 'root_dir_array', 'catalog_after.cfg'],
['Message', 'message', ''],
['Capability', 'capability', ''],
['Require', 'require', ''],
@@ -431,8 +431,8 @@
]
],
['EncryptProgram', 'executable', [ 'gpg', 'pgpe', 'none', ] ],
- ['PIDfile', undef, "$Global::VendRoot/etc/$Global::ExeName.pid"],
- ['SocketFile', 'array', "$Global::VendRoot/etc/socket"],
+ ['PIDfile', 'root_dir', "etc/$Global::ExeName.pid"],
+ ['SocketFile', 'root_dir_array', undef],
['SocketPerms', 'integer', 0600],
['SOAP', 'yesno', 'No'],
['SOAP_Socket', 'array', ''],
@@ -445,7 +445,7 @@
['SOAP_StartServers', 'integer', 1],
['SOAP_Control', 'action', ''],
['Jobs', 'hash', 'MaxLifetime 600 MaxServers 1'],
- ['IPCsocket', undef, "$Global::VendRoot/etc/socket.ipc"],
+ ['IPCsocket', 'root_dir', 'etc/socket.ipc'],
['HouseKeeping', 'time', 60],
['HouseKeepingCron', 'cron', ''],
['Mall', 'yesno', 'No'],
@@ -489,7 +489,7 @@
['HammerLock', 'time', 30],
['DataTrace', 'integer', 0],
['ShowTimes', 'yesno', 0],
- ['ErrorFile', undef, undef],
+ ['ErrorFile', 'root_dir', undef],
['SysLog', 'hash', undef],
['Logging', 'integer', 0],
['CheckHTML', undef, ''],
@@ -516,7 +516,7 @@
# Directive name Parsing function Default value
- ['ErrorFile', undef, 'error.log'],
+ ['ErrorFile', 'relative_dir', 'error.log'],
['ActionMap', 'action', ''],
['FileControl', 'action', ''],
['FormAction', 'action', ''],
@@ -526,6 +526,7 @@
['ProductDir', 'relative_dir', 'products'],
['OfflineDir', 'relative_dir', 'offline'],
['ConfDir', 'relative_dir', 'etc'],
+ ['RunDir', 'relative_dir', ''],
['ConfigDir', 'relative_dir', 'config'],
['TemplateDir', 'dir_array', ''],
['ConfigDatabase', 'config_db', ''],
@@ -1389,7 +1390,7 @@
sub config_named_catalog {
my ($cat_name, $source, $db_only, $dbconfig) = @_;
- my ($g,$c);
+ my ($g, $c, $dir);
$g = $Global::Catalog{$cat_name};
unless (defined $g) {
@@ -1455,7 +1456,8 @@
if (defined $g->{base}) {
open_database(1);
- dump_structure($c, $g->{name}) if $Global::DumpStructure;
+ $dir = $c->{RunDir} || '.';
+ dump_structure($c, "$dir/$g->{name}") if $Global::DumpStructure;
return $c;
}
@@ -1478,13 +1480,15 @@
return undef;
}
- dump_structure($c, $g->{name}) if $Global::DumpStructure;
+ $dir = $c->{RunDir} || '.';
+ dump_structure($c, "$dir/$g->{name}") if $Global::DumpStructure;
delete $c->{Source};
my $stime = scalar localtime();
writefile(">$Global::RunDir/status.$g->{name}", "$stime\n$g->{dir}\n");
- writefile(">$c->{ConfDir}/status.$g->{name}", "$stime\n");
+ $dir = $c->{RunDir} || $c->{ConfDir};
+ writefile(">$dir/status.$g->{name}", "$stime\n");
return $c;
@@ -3371,6 +3375,11 @@
return 1 if $Have_set_global_defaults;
$Global::SOAP_Socket = ['7780']
if $Global::SOAP and ! $Global::SOAP_Socket;
+ return 1;
+ },
+ SocketFile => sub {
+ @$Global::SocketFile = "$Global::VendRoot/etc/socket"
+ unless @$Global::SocketFile;
return 1;
},
TcpMap => sub {
More information about the interchange-cvs
mailing list