Re: SF.net SVN: logwatch:[209] scripts/services/mdadm

"gulikoza" <[email protected]> Tue, 9 Sep 2014 09:53:40 +0200
Newsgroups gmane.comp.log.logwatch.devel
Message-ID <[email protected]>
Hi,

There's a problem with this patch. My original patch jumped to DEV: label
(foreach loop), as it is now it jumps to the inner while loop.
Because of this, the errors still appear as $mdhash is later accessed below:

--------------------- Mdadm Begin ------------------------

 Can't use an undefined value as an ARRAY reference at
/usr/share/logwatch/scripts/services/mdadm line 103.
 mdadm: cannot open /dev/md0: No such file or directory
 /dev/md0 :
          Raid Level :

 ---------------------- Mdadm End -------------------------

Regards,
gulikoza

-----Original Message-----
From: [email protected]
[mailto:[email protected]] 
Sent: Monday, September 08, 2014 10:01 PM
To: [email protected]
Subject: [Logwatch-devel] SF.net SVN: logwatch:[209] scripts/services/mdadm

Revision: 209
          http://sourceforge.net/p/logwatch/code/209
Author:   stefjakobs
Date:     2014-09-08 20:00:42 +0000 (Mon, 08 Sep 2014)
Log Message:
-----------
mdadm: catch 'cannot open ...' error (Thanks: gulikoza)

Modified Paths:
--------------
    scripts/services/mdadm

Modified: scripts/services/mdadm
===================================================================
--- scripts/services/mdadm	2014-09-08 19:50:58 UTC (rev 208)
+++ scripts/services/mdadm	2014-09-08 20:00:42 UTC (rev 209)
@@ -44,8 +44,14 @@
 foreach my $dev (@devices) {
   my %mdhash;
 
-  open(MDADM,"mdadm --misc --detail $dev |");
+  open(MDADM,"mdadm --misc --detail $dev 2>&1 |");
   while (<MDADM>) {
+    if ($_ =~ /cannot open .*: No such file or directory/) {
+      print $_;
+      close(MDADM);
+      next;
+    }
+
     $mdhash{'level'} = $1 if ($_ =~ /Raid Level ?: ?(.*)$/);
     $mdhash{'active'} = $1 if ($_ =~ /Active Devices ?: ?(.*)$/);
     $mdhash{'working'} = $1 if ($_ =~ /Working Devices ?: ?(.*)$/);

This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.


----------------------------------------------------------------------------
--
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce Perforce version control.
Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
Logwatch-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/logwatch-devel


------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce.
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk