mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
small enhancement to data module; pop()
Very simple addon to allow to pop() values from data
This commit is contained in:
parent
05745fa931
commit
eba382cdda
1 changed files with 19 additions and 0 deletions
|
@ -149,3 +149,22 @@ def cas(key, value, old_value):
|
|||
store[key] = value
|
||||
dump(store)
|
||||
return True
|
||||
|
||||
|
||||
def pop(key):
|
||||
'''
|
||||
Return & remove a value from the minion datastore
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
salt '*' data.pop <key>
|
||||
'''
|
||||
store = load()
|
||||
val = None
|
||||
if key in store:
|
||||
val = store.pop(key)
|
||||
dump(store)
|
||||
|
||||
return val
|
||||
|
|
Loading…
Add table
Reference in a new issue