mirror of
https://github.com/valitydev/salt.git
synced 2024-11-09 01:36:48 +00:00
Merge pull request #34698 from techhat/thoriumstamp
Add timestamping to reg.list
This commit is contained in:
commit
5c3ff22283
@ -35,9 +35,21 @@ def set_(name, add, match):
|
||||
return ret
|
||||
|
||||
|
||||
def list_(name, add, match):
|
||||
def list_(name, add, match, stamp=False):
|
||||
'''
|
||||
Add to the named list the specified values
|
||||
Add the specified values to the named list
|
||||
|
||||
If ``stamp`` is True, then the timestamp from the event will also be added
|
||||
|
||||
USAGE::
|
||||
|
||||
code-block:: yaml
|
||||
|
||||
foo:
|
||||
reg.list:
|
||||
- add: bar
|
||||
- match: my/custom/event
|
||||
- stamp: True
|
||||
'''
|
||||
ret = {'name': name,
|
||||
'changes': {},
|
||||
@ -54,6 +66,8 @@ def list_(name, add, match):
|
||||
for key in add:
|
||||
if key in event['data']['data']:
|
||||
item[key] = event['data']['data'][key]
|
||||
if stamp is True:
|
||||
item['time'] = event['data']['_stamp']
|
||||
__reg__[name]['val'].append(item)
|
||||
return ret
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user