Merge pull request #34522 from thatch45/checkev

Add check.event to thorium
This commit is contained in:
Mike Place 2016-07-07 15:02:02 -06:00 committed by GitHub
commit c35b16a355
2 changed files with 29 additions and 2 deletions

View File

@ -136,3 +136,32 @@ def contains(name, value):
except TypeError:
pass
return ret
def event(name):
'''
Chekcs for a specific event match and returns result True if the match
happens
USAGE::
code-block:: yaml
salt/foo/*/bar:
check.event
run_remote_ex:
local.cmd:
- tgt: '*'
- func: test.ping
- require:
- check: salt/foo/*/bar
'''
ret = {'name': name,
'changes': {},
'comment': '',
'result': False}
for event in __events__:
if fnmatch.fnmatch(event['tag'], name):
ret['result'] = True
return ret

View File

@ -49,8 +49,6 @@ def list_(name, add, match):
__reg__[name] = {}
__reg__[name]['val'] = []
for event in __events__:
import pprint
pprint.pprint(event)
if fnmatch.fnmatch(event['tag'], match):
item = {}
for key in add: