[Mageia-sysadm] [126] use upload.conf from /etc/iurt if not in home ( could be factorized together and with iurt config file code)

root at mageia.org root at mageia.org
Tue Nov 23 22:52:13 CET 2010


Revision: 126
Author:   blino
Date:     2010-11-23 22:52:12 +0100 (Tue, 23 Nov 2010)
Log Message:
-----------
use upload.conf from /etc/iurt if not in home (could be factorized together and with iurt config file code)

Modified Paths:
--------------
    build_system/iurt/trunk/emi
    build_system/iurt/trunk/ulri

Modified: build_system/iurt/trunk/emi
===================================================================
--- build_system/iurt/trunk/emi	2010-11-23 20:45:58 UTC (rev 125)
+++ build_system/iurt/trunk/emi	2010-11-23 21:52:12 UTC (rev 126)
@@ -46,7 +46,18 @@
 my $HOME = $ENV{HOME};
 
 my $configfile = "$HOME/.upload.conf";
+my $sysconfigfile = "/etc/iurt/upload.conf";
 
+my $config = {};
+foreach my $f ($configfile, $sysconfigfile) {
+    plog('DEBUG', "load config: $f");
+    if (-f $f) {
+        $config = eval(cat_($f))
+          or die "FATAL $program_name: syntax error in $f";
+        last;
+    }
+}
+
 my %config_usage = ( 
     admin => {
 	desc => 'mail address of the bot administrator',
@@ -94,14 +105,6 @@
     },
 );
 
-my $config;
-if (-f $configfile) {
-    $config = eval(cat_($configfile))
-	or die "FATAL $program_name: syntax error in $configfile";
-} else {
-    $config = {};
-}
-
 config_usage(\%config_usage, $config) if $run{config_usage};
 config_init(\%config_usage, $config, \%run);
 

Modified: build_system/iurt/trunk/ulri
===================================================================
--- build_system/iurt/trunk/ulri	2010-11-23 20:45:58 UTC (rev 125)
+++ build_system/iurt/trunk/ulri	2010-11-23 21:52:12 UTC (rev 126)
@@ -55,12 +55,16 @@
 
 my $HOME = $ENV{HOME};
 my $configfile = "$HOME/.upload.conf";
+my $sysconfigfile = "/etc/iurt/upload.conf";
 
-my $config;
-if (-f $configfile) {
-    $config = eval(cat_($configfile)) or die "FATAL $program_name: syntax error in $configfile";
-} else {
-    $config = {};
+my $config = {};
+foreach my $f ($configfile, $sysconfigfile) {
+    plog('DEBUG', "load config: $f");
+    if (-f $f) {
+        $config = eval(cat_($f))
+          or die "FATAL $program_name: syntax error in $f";
+        last;
+    }
 }
 
 my %config_usage = ( 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/mageia-sysadm/attachments/20101123/d4ac661d/attachment-0001.html>


More information about the Mageia-sysadm mailing list