small enhancement to data module; pop()

Very simple addon to allow to pop() values from data
This commit is contained in:
Ronald van Zantvoort 2015-05-27 02:42:49 +02:00
parent 05745fa931
commit eba382cdda

View file

@ -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