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

From caffb14059c2d4ab186cb24918f4e53332f697af 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 |  7 -------
 salt/minion.py      | 10 ++++++++++
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/salt/grains/core.py b/salt/grains/core.py
index d7d03c5e70..5f18ba4a58 100644
--- a/salt/grains/core.py
+++ b/salt/grains/core.py
@@ -3066,13 +3066,6 @@ def get_server_id():
                 & 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 4da665a130..4d271c6d08 100644
--- a/salt/minion.py
+++ b/salt/minion.py
@@ -82,6 +82,7 @@ from salt.utils.event import tagify
 from salt.utils.network import parse_host_port
 from salt.utils.odict import OrderedDict
 from salt.utils.process import ProcessManager, SignalHandlingProcess, default_signals
+from salt.utils.versions import warn_until
 from salt.utils.zeromq import ZMQ_VERSION_INFO, ZMQDefaultLoop, install_zmq, zmq
 
 HAS_PSUTIL = False
@@ -1096,6 +1097,15 @@ class MinionManager(MinionBase):
         ):
             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.29.2


openSUSE Build Service is sponsored by