Bug #2144

Ardad: ardad fails when no backup is configured

Added by Giacomo Sanchietti almost 8 years ago. Updated almost 8 years ago.

Status:CLOSEDStart date:09/03/2013
Priority:NormalDue date:09/16/2013
Assignee:-% Done:

100%

Category:nethserver-ardad
Target version:v6.4-beta2
Security class: Resolution:
Affected version:v6.4-beta1 NEEDINFO:No

Description

When no backup is configured, /usr/sbin/nethserver_dumper.pl script fails with an error:
Couldn't open location file: No such file or directory at /usr/sbin/nethserver_dumper.pl line 86.

Avoid the error skipping backup check if backup log file (/var/log/backup-data.log) doesn't exists.

Tested patch:

--- /usr/sbin/nethserver_dumper.pl.ori    2013-08-29 11:01:16.592113259 +0200
+++ /usr/sbin/nethserver_dumper.pl    2013-08-29 11:03:20.295931952 +0200
@@ -82,26 +82,31 @@

 # Backup
-my @lines;
-open (FILE, "/var/log/backup-data.log") or die "Couldn't open location file: $!";
-while (<FILE>) {
-    push(@lines, [split(' - ', $_)]);
-}
-close FILE;
-my @r = reverse(@lines);
-foreach my $field (0..@r-1) {
-   if ($r[$field][1] eq 'START') {
-       $dump_map{'BackupStart'} = str2time($r[$field][0]);
-       last;
-   }
-}
-$dump_map{'BackupEnd'} = str2time($lines[-1][0]);
-if ($lines[-1][1] eq "SUCCESS") {
-    $dump_map{'BackupResult'} = 0;
+if ( -f "/var/log/backup-data.log") {
+    my @lines;
+    open (FILE, "/var/log/backup-data.log") or die "Couldn't open location file: $!";
+    while (<FILE>) {
+        push(@lines, [split(' - ', $_)]);
+    }
+    close FILE;
+    my @r = reverse(@lines);
+    foreach my $field (0..@r-1) {
+       if ($r[$field][1] eq 'START') {
+           $dump_map{'BackupStart'} = str2time($r[$field][0]);
+           last;
+       }
+    }
+    $dump_map{'BackupEnd'} = str2time($lines[-1][0]);
+    if ($lines[-1][1] eq "SUCCESS") {
+        $dump_map{'BackupResult'} = 0;
+    } else {
+        $dump_map{'BackupResult'} = 1;
+    }
+    $dump_map{'BackupType'} = $db->get_prop('backup-data','VFSType') || "";
 } else {
-    $dump_map{'BackupResult'} = 1;
+    $dump_map{'BackupResult'} = 0;
+    $dump_map{'BackupType'} = "";
 }
-$dump_map{'BackupType'} = $db->get_prop('backup-data','VFSType') || "";

 # Raid
 sub broken_raid_devices {

History

#1 Updated by Giacomo Sanchietti almost 8 years ago

  • Status changed from NEW to TRIAGED
  • % Done changed from 0 to 20

#2 Updated by Giacomo Sanchietti almost 8 years ago

  • Status changed from TRIAGED to ON_DEV
  • Assignee set to Giacomo Sanchietti
  • % Done changed from 20 to 30

#3 Updated by Giacomo Sanchietti almost 8 years ago

  • Affected version changed from v6.4-beta2 to v6.4-beta1

#4 Updated by Giacomo Sanchietti almost 8 years ago

  • Status changed from ON_DEV to MODIFIED
  • % Done changed from 30 to 60

#5 Updated by Giacomo Sanchietti almost 8 years ago

  • Status changed from MODIFIED to ON_QA
  • Assignee deleted (Giacomo Sanchietti)
  • % Done changed from 60 to 70
New package in nethserver-testing:
  • ardad-2.9.3-2.nh.x86_64.rpm

Test case:
Install on a clean and registered machine without backup configured, and execute:

ardad --dump

No errors should come up.

#6 Updated by Davide Principi almost 8 years ago

  • Due date set to 09/16/2013
  • Assignee set to Davide Principi
  • Start date set to 09/03/2013

#7 Updated by Davide Principi almost 8 years ago

  • Status changed from ON_QA to VERIFIED
  • Assignee deleted (Davide Principi)
  • % Done changed from 70 to 90

VERIFIED

#8 Updated by Giacomo Sanchietti almost 8 years ago

  • Status changed from VERIFIED to CLOSED
  • % Done changed from 90 to 100
In nethserver-updates:
  • ardad-2.9.3-2.nh.x86_64.rpm

Also available in: Atom PDF