2021-01-08 13:41:50 +01:00
|
|
|
From 03f0aa44f6963e09a92dd3ea2090ef9ee463cb94 Mon Sep 17 00:00:00 2001
|
2019-11-28 16:41:55 +01:00
|
|
|
From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?=
|
|
|
|
<psuarezhernandez@suse.com>
|
|
|
|
Date: Wed, 5 Jun 2019 15:15:04 +0100
|
2021-01-08 13:41:50 +01:00
|
|
|
Subject: [PATCH] batch.py: avoid exception when minion does not
|
|
|
|
respond (bsc#1135507)
|
2019-06-14 14:50:01 +02:00
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Type: text/plain; charset=UTF-8
|
|
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
|
|
|
|
We have several issues reporting that salt is throwing exception when
|
|
|
|
the minion does not respond. This change avoid the exception adding a
|
|
|
|
default data to the minion when it fails to respond. This patch based
|
|
|
|
on the patch suggested by @roskens.
|
|
|
|
|
|
|
|
Issues #46876 #48509 #50238
|
|
|
|
bsc#1135507
|
|
|
|
|
|
|
|
Signed-off-by: José Guilherme Vanz <jguilhermevanz@suse.com>
|
|
|
|
---
|
2021-01-08 13:41:50 +01:00
|
|
|
salt/cli/batch.py | 8 ++++++++
|
|
|
|
1 file changed, 8 insertions(+)
|
2019-06-14 14:50:01 +02:00
|
|
|
|
|
|
|
diff --git a/salt/cli/batch.py b/salt/cli/batch.py
|
2021-01-08 13:41:50 +01:00
|
|
|
index 2bc5444aef..6285a45434 100644
|
2019-06-14 14:50:01 +02:00
|
|
|
--- a/salt/cli/batch.py
|
|
|
|
+++ b/salt/cli/batch.py
|
2021-01-08 13:41:50 +01:00
|
|
|
@@ -348,6 +348,14 @@ class Batch:
|
|
|
|
if self.opts.get("failhard") and data["retcode"] > 0:
|
2019-06-14 14:50:01 +02:00
|
|
|
failhard = True
|
|
|
|
|
|
|
|
+ # avoid an exception if the minion does not respond.
|
|
|
|
+ if data.get("failed") is True:
|
2021-01-08 13:41:50 +01:00
|
|
|
+ log.debug("Minion %s failed to respond: data=%s", minion, data)
|
|
|
|
+ data = {
|
|
|
|
+ "ret": "Minion did not return. [Failed]",
|
|
|
|
+ "retcode": salt.defaults.exitcodes.EX_GENERIC,
|
|
|
|
+ }
|
2019-06-14 14:50:01 +02:00
|
|
|
+
|
2021-01-08 13:41:50 +01:00
|
|
|
if self.opts.get("raw"):
|
2019-06-14 14:50:01 +02:00
|
|
|
ret[minion] = data
|
|
|
|
yield data
|
|
|
|
--
|
2021-01-08 13:41:50 +01:00
|
|
|
2.29.2
|
2019-06-14 14:50:01 +02:00
|
|
|
|
|
|
|
|