Description: Fix log severity in some command line tools used in postinst
Author: Emmanuel Bouthenot <kolter@debian.org>
Forwarded: no
Last-Update: 2016-09-17
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/src/sbin/sympa.pl.in
+++ b/src/sbin/sympa.pl.in
@@ -232,9 +232,8 @@
 
     ## Check that the data structure is uptodate
     unless (Conf::data_structure_uptodate()) {
-        printf STDERR
+        printf STDOUT
             "Data structure was not updated; you should run sympa.pl --upgrade to run the upgrade process.\n";
-        exit 1;
     }
 
     exit 0;
@@ -787,7 +786,7 @@
     $main::options{'to'}   ||= Sympa::Constants::VERSION;
 
     if ($main::options{'from'} eq $main::options{'to'}) {
-        $log->syslog('err', 'Current version: %s; no upgrade is required',
+        $log->syslog('notice', 'Current version: %s; no upgrade is required',
             $main::options{'to'});
         exit 0;
     } else {
--- a/src/bin/upgrade_bulk_spool.pl.in
+++ b/src/bin/upgrade_bulk_spool.pl.in
@@ -84,6 +84,29 @@
     my $sdm = Sympa::DatabaseManager->instance
         or die 'Can\'t connect to database';
 
+    # Checking if bulkmailer_table exits
+    my @tables;
+    my $list_of_tables;
+    if ($list_of_tables = $sdm->get_tables()) {
+        @tables = @{$list_of_tables};
+    } else {
+        @tables = ();
+    }
+    my $found = 0;
+    foreach my $t (@tables) {
+        if ($t eq "bulkmailer_table") {
+            $found = 1;
+            last;
+        }
+    }
+    if ($found == 0) {
+        $log->syslog(
+            'notice',
+            'bulkmailer table not found in database, bulk spool of your Sympa is probably up-to-date'
+        );
+        exit 0;
+    }
+
     my $sth = $sdm->do_prepared_query(
         q{SELECT *
           FROM bulkmailer_table
