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.'