Skip to content

How does "names" work? #67206

Answered by lkubb
Mogaba asked this question in Q&A
Jan 28, 2025 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

I think you're pointing out an oversimplification in the docs.

In general, duplicate state IDs are disallowed in the highstate data structure because it's a mapping, where duplicate keys would necessarily overwrite each other (and, if defined in the same SLS, be unrepresentable).

The names parameter influences the state compiler (which compiles the highstate data structure into lowstate chunks), specifically here:

salt/salt/state.py

Lines 676 to 692 in 9233e1c

if names:
name_order = 1
for entry in names:
live = copy.deepcopy(chunk)
if isinstance(entry, dict):
low_name = next(iter(entry.keys()))
live["name"] = low_name
list(map(live.update, entry

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@whytewolf
Comment options

@lkubb
Comment options

@Mogaba
Comment options

Answer selected by Mogaba
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants