saltstack/salt — Issue #746: Support multiple ids with the same name
Author: SEJeff
Created: 2012-02-23 22:49:51+00:00
State: open

This is mainly a braindump / placeholder between my convo with @thatch45 about a crazy idea I had. Right now, state files have to have globally unique "id" attributes for everything in every state. This is less than ideal and even though we check for it and complain, not the best thing in the world.

Right now the way to fix duplicated ids is to change the id to something arbitrary of one of the declarations and then give it the ```- name``` attribute to specify the name the id actually should use. My proposal is to _always_ use ```- name``` even when it is not specified and do nothing when it is. The pseudocode would basically be as such:

if name is not specified:
name = id
id = id + some random consistent hash (md5 or something) or just a consistent hash

Then you can have multiple ids in a set of state files that are identical. When salt compiles it down to the lowstate, the ids will be transformed into hashed versions and the ```- name``` attribute will be set. Per Tom, there will be some oddities with ```extend``` and ```include``` statements.

Just wanted to document this before I forget about it.