saltstack/salt — Issue #631: Can't extend the same item multiple times
Author: fatbox
Created: 2012-02-02 01:03:43+00:00
State: open

As I'm using macro's more and more I've discovered that you cannot extend the same item multiple times.

Here's a simple example that demonstrates it:

apache2:
service:
- running

/etc/apache2/apache2.conf:
file:
- managed
- user: root

/etc/apache2/ports.conf:
file:
- managed
- user: root

extend:
apache2:
service:
watch:
- file: /etc/apache2/apache2.conf

extend:
apache2:
service:
watch:
- file: /etc/apache2/ports.conf

I would expect that the apache2 service would be extended to watch both files but as you can see in the compiled state it's only watching the last item defined.

{'local': {'/etc/apache2/apache2.conf': {'__env__': 'base',
'__sls__': 'extendtest',
'file': ['managed',
{'user': 'root'}]},
'/etc/apache2/ports.conf': {'__env__': 'base',
'__sls__': 'extendtest',
'file': ['managed', {'user': 'root'}]},
'__extend__': [{'apache2': {'__env__': 'base',
'__sls__': 'extendtest',
'service': {'watch': [{'file': '/etc/apache2/ports.conf'}]}}}],
'apache2': {'__env__': 'base',
'__sls__': 'extendtest',
'service': ['running']}}}