File move-server_id-deprecation-warning-to-reduce-log-spa.patch of Package salt

From c375d1e25e8b5c77b6a8f89855f17df6e49db9f2 Mon Sep 17 00:00:00 2001
From: Mihai Dinca <mdinca@suse.de>
Date: Fri, 14 Jun 2019 15:13:12 +0200
Subject: [PATCH] Move server_id deprecation warning to reduce log
 spamming (bsc#1135567) (bsc#1135732)

---
 salt/grains/core.py | 4 ----
 salt/minion.py      | 9 +++++++++
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/salt/grains/core.py b/salt/grains/core.py
index b58c29dbc3..0f3ccd9b92 100644
--- a/salt/grains/core.py
+++ b/salt/grains/core.py
@@ -2890,10 +2890,6 @@ def get_server_id():
         if bool(use_crc):
             id_hash = getattr(zlib, use_crc, zlib.adler32)(__opts__.get('id', '').encode()) & 0xffffffff
         else:
-            salt.utils.versions.warn_until('Sodium', 'This server_id is computed nor by Adler32 neither by CRC32. '
-                                                     'Please use "server_id_use_crc" option and define algorithm you'
-                                                     'prefer (default "Adler32"). The server_id will be computed with'
-                                                     'Adler32 by default.')
             id_hash = _get_hash_by_shell()
         server_id = {'server_id': id_hash}
 
diff --git a/salt/minion.py b/salt/minion.py
index 457f485b0a..4730f68b87 100644
--- a/salt/minion.py
+++ b/salt/minion.py
@@ -97,6 +97,7 @@ from salt.utils.odict import OrderedDict
 from salt.utils.process import (default_signals,
                                 SignalHandlingProcess,
                                 ProcessManager)
+from salt.utils.versions import warn_until
 from salt.exceptions import (
     CommandExecutionError,
     CommandNotFoundError,
@@ -1002,6 +1003,14 @@ class MinionManager(MinionBase):
         if (self.opts['master_type'] in ('failover', 'distributed')) or not isinstance(self.opts['master'], list):
             masters = [masters]
 
+        if not self.opts.get('server_id_use_crc'):
+            warn_until(
+                'Sodium',
+                'This server_id is computed nor by Adler32 neither by CRC32. '
+                 'Please use "server_id_use_crc" option and define algorithm you'
+                 'prefer (default "Adler32"). The server_id will be computed with'
+                 'Adler32 by default.')
+
         beacons_leader = True
         for master in masters:
             s_opts = copy.deepcopy(self.opts)
-- 
2.16.4


openSUSE Build Service is sponsored by