andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 6 months ago
Clone

Blame SOURCES/0008-Ticket-48119-setup-ds.pl-does-not-log-invalid-file-p.patch

a2f18f
From 7f10ea89c30944fc60a95d53e544caa005c03e0e Mon Sep 17 00:00:00 2001
a2f18f
From: Mark Reynolds <mreynolds@redhat.com>
a2f18f
Date: Mon, 6 Jul 2015 15:55:43 -0400
a2f18f
Subject: [PATCH] Ticket 48119 - setup-ds.pl does not log invalid --file path
a2f18f
 errors the same way as other errors.
a2f18f
a2f18f
Bug Description:  Errors occuring from Inf.pm are only written to STDERR
a2f18f
a2f18f
Fix Description:  Write errors from Inf.pm using the debug function
a2f18f
a2f18f
https://fedorahosted.org/389/ticket/48119
a2f18f
a2f18f
Reviewed by: nhosoi(Thanks!)
a2f18f
a2f18f
(cherry picked from commit 6306fc4e8eb2fb5973360f550c83e3c9b220df5c)
a2f18f
(cherry picked from commit 5bd7119d8529e1c0b763c45e3ec7d1fb497da6c8)
a2f18f
---
a2f18f
 ldap/admin/src/scripts/Inf.pm | 9 +++++----
a2f18f
 1 file changed, 5 insertions(+), 4 deletions(-)
a2f18f
a2f18f
diff --git a/ldap/admin/src/scripts/Inf.pm b/ldap/admin/src/scripts/Inf.pm
a2f18f
index 98649ac..ec433e2 100644
a2f18f
--- a/ldap/admin/src/scripts/Inf.pm
a2f18f
+++ b/ldap/admin/src/scripts/Inf.pm
a2f18f
@@ -12,6 +12,7 @@
a2f18f
 
a2f18f
 package Inf;
a2f18f
 
a2f18f
+use DSUtil;
a2f18f
 use File::Temp qw(tempfile tempdir);
a2f18f
 
a2f18f
 #require    Exporter;
a2f18f
@@ -59,7 +60,7 @@ sub read {
a2f18f
         $inffh = \*STDIN;
a2f18f
     } else {
a2f18f
         if (!open(INF, $filename)) {
a2f18f
-            print STDERR "Error: could not open inf file $filename: $!\n";
a2f18f
+            debug(0, "Error: could not open inf file $filename: $!\n");
a2f18f
             return;
a2f18f
         }
a2f18f
         $inffh = \*INF;
a2f18f
@@ -124,7 +125,7 @@ sub section {
a2f18f
     my $key = shift;
a2f18f
 
a2f18f
     if (!exists($self->{$key})) {
a2f18f
-        print "Error: unknown inf section $key\n";
a2f18f
+        debug(0, "Error: unknown inf section $key\n");
a2f18f
         return undef;
a2f18f
     }
a2f18f
 
a2f18f
@@ -187,7 +188,7 @@ sub write {
a2f18f
     my $savemask = umask(0077);
a2f18f
     if (!$fh) {
a2f18f
         if (!open(INF, ">$filename")) {
a2f18f
-            print STDERR "Error: could not write inf file $filename: $!\n";
a2f18f
+            debug(0, "Error: could not write inf file $filename: $!\n");
a2f18f
             umask($savemask);
a2f18f
             return;
a2f18f
         }
a2f18f
@@ -232,7 +233,7 @@ sub updateFromArgs {
a2f18f
                 $argsinf->{$sec}->{$parm} = $val;
a2f18f
             }
a2f18f
         } else { # error
a2f18f
-            print STDERR "Error: unknown command line option $arg\n";
a2f18f
+            debug(0, "Error: unknown command line option $arg\n");
a2f18f
             return;
a2f18f
         }
a2f18f
     }
a2f18f
-- 
a2f18f
1.9.3
a2f18f