mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Add clear() and delete() to the thorium register
This commit is contained in:
parent
c6700a219a
commit
13516fd33d
@ -98,3 +98,31 @@ def mean(name, add, match):
|
||||
__reg__[name]['count'] += 1
|
||||
__reg__[name]['val'] = __reg__[name]['total'] / __reg__[name]['count']
|
||||
return ret
|
||||
|
||||
|
||||
def clear(name):
|
||||
'''
|
||||
Clear the register
|
||||
'''
|
||||
ret = {'name': name,
|
||||
'changes': {},
|
||||
'comment': '',
|
||||
'result': True}
|
||||
if name in __reg__ and isinstance(__reg__[name], set):
|
||||
__reg__[name] = {'val': set()}
|
||||
else:
|
||||
__reg__[name] = {'val': []}
|
||||
return ret
|
||||
|
||||
|
||||
def delete(name):
|
||||
'''
|
||||
Clear the register
|
||||
'''
|
||||
ret = {'name': name,
|
||||
'changes': {},
|
||||
'comment': '',
|
||||
'result': True}
|
||||
if name in __reg__:
|
||||
del __reg__[name]
|
||||
return ret
|
||||
|
Loading…
Reference in New Issue
Block a user