mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Fix grains.get_or_set_hash to work with multiple entries under same key
This commit is contained in:
parent
20d8f757dd
commit
81746bcaee
@ -514,9 +514,12 @@ def get_or_set_hash(name,
|
|||||||
val = ''.join([random.SystemRandom().choice(chars) for _ in range(length)])
|
val = ''.join([random.SystemRandom().choice(chars) for _ in range(length)])
|
||||||
|
|
||||||
if ':' in name:
|
if ':' in name:
|
||||||
name, rest = name.split(':', 1)
|
root, rest = name.split(':', 1)
|
||||||
|
curr = get(root, _infinitedict())
|
||||||
val = _dict_from_path(rest, val)
|
val = _dict_from_path(rest, val)
|
||||||
|
curr.update(val)
|
||||||
|
setval(root, curr)
|
||||||
|
else:
|
||||||
setval(name, val)
|
setval(name, val)
|
||||||
|
|
||||||
return get(name)
|
return get(name)
|
||||||
|
Loading…
Reference in New Issue
Block a user