mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
allow sync_grains to be disabled on grains.setval
This commit is contained in:
parent
239e16e612
commit
709c197f84
1 changed files with 4 additions and 4 deletions
|
@ -192,7 +192,7 @@ def item(*args, **kwargs):
|
|||
return ret
|
||||
|
||||
|
||||
def setvals(grains, destructive=False):
|
||||
def setvals(grains, destructive=False, refresh=True):
|
||||
'''
|
||||
Set new grains values in the grains config file
|
||||
|
||||
|
@ -275,12 +275,12 @@ def setvals(grains, destructive=False):
|
|||
log.error(msg.format(fn_))
|
||||
if not __opts__.get('local', False):
|
||||
# Sync the grains
|
||||
__salt__['saltutil.sync_grains']()
|
||||
__salt__['saltutil.sync_grains'](refresh=refresh)
|
||||
# Return the grains we just set to confirm everything was OK
|
||||
return new_grains
|
||||
|
||||
|
||||
def setval(key, val, destructive=False):
|
||||
def setval(key, val, destructive=False, refresh=True):
|
||||
'''
|
||||
Set a grains value in the grains config file
|
||||
|
||||
|
@ -301,7 +301,7 @@ def setval(key, val, destructive=False):
|
|||
salt '*' grains.setval key val
|
||||
salt '*' grains.setval key "{'sub-key': 'val', 'sub-key2': 'val2'}"
|
||||
'''
|
||||
return setvals({key: val}, destructive)
|
||||
return setvals({key: val}, destructive, refresh)
|
||||
|
||||
|
||||
def append(key, val, convert=False, delimiter=DEFAULT_TARGET_DELIM):
|
||||
|
|
Loading…
Add table
Reference in a new issue