51d9b78cf8
OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:saltstack/salt?expand=0&rev=156
44 lines
1.5 KiB
Diff
44 lines
1.5 KiB
Diff
From b7e1ff5b0d023fef1f86fa970323dc01bfaabd41 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?=
|
|
<psuarezhernandez@suse.com>
|
|
Date: Wed, 5 Jun 2019 15:15:04 +0100
|
|
Subject: [PATCH] batch.py: avoid exception when minion does not respond
|
|
(bsc#1135507)
|
|
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>
|
|
---
|
|
salt/cli/batch.py | 5 +++++
|
|
1 file changed, 5 insertions(+)
|
|
|
|
diff --git a/salt/cli/batch.py b/salt/cli/batch.py
|
|
index 67f03c8a45..10fc81a5f4 100644
|
|
--- a/salt/cli/batch.py
|
|
+++ b/salt/cli/batch.py
|
|
@@ -318,6 +318,11 @@ class Batch(object):
|
|
if self.opts.get('failhard') and data['retcode'] > 0:
|
|
failhard = True
|
|
|
|
+ # avoid an exception if the minion does not respond.
|
|
+ if data.get("failed") is True:
|
|
+ log.debug('Minion %s failed to respond: data=%s', minion, data)
|
|
+ data = {'ret': 'Minion did not return. [Failed]', 'retcode': salt.defaults.exitcodes.EX_GENERIC}
|
|
+
|
|
if self.opts.get('raw'):
|
|
ret[minion] = data
|
|
yield data
|
|
--
|
|
2.16.4
|
|
|
|
|