From 91e74feaf36a61a44b071ea3b240cbcb2d4cdda3 Mon Sep 17 00:00:00 2001 From: Brendan McGrath Date: Sun, 21 Feb 2016 12:39:36 +1100 Subject: [PATCH] Added sanity check: is 'pillar' in self.opts This fixes an exception that is thrown when using the 'when' clause in a master scheduler. The master does not appear to create a 'pillar' entry in self.opts --- salt/utils/schedule.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/salt/utils/schedule.py b/salt/utils/schedule.py index 5ed49f73da70..13c6dc06517f 100644 --- a/salt/utils/schedule.py +++ b/salt/utils/schedule.py @@ -867,7 +867,7 @@ def eval(self): if isinstance(data['when'], list): _when = [] for i in data['when']: - if ('whens' in self.opts['pillar'] and + if ('pillar' in self.opts and 'whens' in self.opts['pillar'] and i in self.opts['pillar']['whens']): if not isinstance(self.opts['pillar']['whens'], dict): @@ -936,7 +936,7 @@ def eval(self): continue else: - if ('whens' in self.opts['pillar'] and + if ('pillar' in self.opts and 'whens' in self.opts['pillar'] and data['when'] in self.opts['pillar']['whens']): if not isinstance(self.opts['pillar']['whens'], dict): log.error('Pillar item "whens" must be dict.'