MCPcopy
hub / github.com/saltstack/salt / setval

Function setval

salt/modules/grains.py:300–325  ·  view source on GitHub ↗

Set a grains value in the grains config file key The grain key to be set. val The value to set the grain key to. destructive If an operation results in a key being removed, delete the key, too. Defaults to False. refresh_pillar Whether

(key, val, destructive=False, refresh_pillar=True)

Source from the content-addressed store, hash-verified

298
299
300def setval(key, val, destructive=False, refresh_pillar=True):
301 """
302 Set a grains value in the grains config file
303
304 key
305 The grain key to be set.
306
307 val
308 The value to set the grain key to.
309
310 destructive
311 If an operation results in a key being removed, delete the key, too.
312 Defaults to False.
313
314 refresh_pillar
315 Whether pillar will be refreshed.
316 Defaults to True.
317
318 CLI Example:
319
320 .. code-block:: bash
321
322 salt '*' grains.setval key val
323 salt '*' grains.setval key "{'sub-key': 'val', 'sub-key2': 'val2'}"
324 """
325 return setvals({key: val}, destructive, refresh_pillar=refresh_pillar)
326
327
328def append(key, val, convert=False, delimiter=DEFAULT_TARGET_DELIM):

Callers 3

appendFunction · 0.70
removeFunction · 0.70
setFunction · 0.70

Calls 1

setvalsFunction · 0.85

Tested by

no test coverage detected