File 0017-Fix-crash-with-scheduler-and-runners-31106.patch of Package salt.3314
From 978afba658cff38ebc1d6a7aecee4813796db528 Mon Sep 17 00:00:00 2001
From: Duncan Mac-Vicar P <dmacvicar@suse.de>
Date: Sat, 13 Feb 2016 00:23:30 +0100
Subject: [PATCH 17/22] Fix crash with scheduler and runners (#31106)
* runner wrapper ClientFuncsDict do not provide access to 'pack' attribute
* runners do not provide retcode, therefore ignore it in the schedule if it is not
provided by __context__
---
salt/client/mixins.py | 6 ++++++
salt/utils/schedule.py | 5 ++++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/salt/client/mixins.py b/salt/client/mixins.py
index cdb1d0c..6fa3e6f 100644
--- a/salt/client/mixins.py
+++ b/salt/client/mixins.py
@@ -53,6 +53,12 @@ class ClientFuncsDict(collections.MutableMapping):
def __init__(self, client):
self.client = client
+ def __getattr__(self, attr):
+ '''
+ Provide access eg. to 'pack'
+ '''
+ return getattr(self.client.functions, attr)
+
def __setitem__(self, key, val):
raise NotImplementedError()
diff --git a/salt/utils/schedule.py b/salt/utils/schedule.py
index cae5fcf..5ed49f7 100644
--- a/salt/utils/schedule.py
+++ b/salt/utils/schedule.py
@@ -700,7 +700,10 @@ class Schedule(object):
)
)
- ret['retcode'] = self.functions.pack['__context__']['retcode']
+ # runners do not provide retcode
+ if 'retcode' in self.functions.pack['__context__']:
+ ret['retcode'] = self.functions.pack['__context__']['retcode']
+
ret['success'] = True
except Exception:
log.exception("Unhandled exception running {0}".format(ret['fun']))
--
2.1.4