mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Merge pull request #34522 from thatch45/checkev
Add check.event to thorium
This commit is contained in:
commit
c35b16a355
@ -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
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user