From 66fdb39fd5f11e53aebc48033a5666196b23dae8 Mon Sep 17 00:00:00 2001 From: Ronald van Zantvoort Date: Wed, 27 May 2015 18:02:24 +0200 Subject: [PATCH] Merge fix Merge fix for #24160 --- salt/modules/data.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/salt/modules/data.py b/salt/modules/data.py index 4f23d1a989..1c2349e20f 100644 --- a/salt/modules/data.py +++ b/salt/modules/data.py @@ -156,6 +156,24 @@ def cas(key, value, old_value): return True +def pop(key, default=None): + ''' + Pop (return & delete) a value from the minion datastore + + .. versionadded:: 2015.5.2 + + CLI Example: + + .. code-block:: bash + + salt '*' data.pop "there was no val" + ''' + store = load() + val = store.pop(key, default) + dump(store) + return val + + def get(key, default=None): ''' Get a (list of) value(s) from the minion datastore @@ -240,21 +258,3 @@ def has_key(key): ''' store = load() return key in store - - -def pop(key, default=None): - ''' - Pop (return & delete) a value from the minion datastore - - .. versionadded:: Beryllium - - CLI Example: - - .. code-block:: bash - - salt '*' data.pop "there was no val" - ''' - store = load() - val = store.pop(key, default) - dump(store) - return val