You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
yamlex !reset doesn't work when combining pillars across environments #18665
Corerelates to code central or existential to SaltP4Priority 4Pillarbugbroken, incorrect, or confusing behaviorseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work aroundstale
I've come across a strange bug - or something I'm doing wrong that I can't pinpoint. I'm using the yamlex renderer and !reset, however reset is not honored when run through salt.
If I run the same yaml through the yamlex deserializer on the command line it works as expected. I'm running 2014.7.0.
Here's an example of the issue I've found:
[root@salt-master pillar]# cat base/ssh.sls
#!yamlex
ssh: !aggregate
keys: !aggregate
- one: b
two: a
[root@salt-master pillar]# cat group/ssh.sls
#!yamlex
!reset ssh: !aggregate
!reset keys: !aggregate
- three: a
four: b
[root@salt-master pillar]# cat base/top.sls
base:
'*':
- ssh
group:
'*':
- ssh
[root@salt-master pillar]# salt 'qa-server*' pillar.items
qa-server:
----------
ssh:
----------
keys:
|_
----------
four:
b
three:
a
|_
----------
one:
b
two:
a
The above should have reset the 'keys' array and contained only the single array with 'four' and 'three' keys. The below test is how I expected this to act, and it appears to work correctly if run on the command line with the same yaml.
[root@salt-master pillar]# cat test.py
#!/usr/bin/python
from salt.utils.serializers.yamlex import serialize, deserialize
parseme = '''
ssh: !aggregate
keys: !aggregate
- one: b
two: a
!reset ssh: !aggregate
!reset keys: !aggregate
- three: a
four: b
'''
print deserialize(parseme)
[root@salt-master pillar]# python test.py
{ssh: {keys: [{three: a, four: b}]}}
@wickedbill, I am unable to reproduce this bug. I'm not sure how yamlex is
being disabled on your system. This is what I did, please comment if I have
done something wrong.
setup
jmoney-main ~ master # lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux testing (jessie)
Release: testing
Codename: jessie
jmoney-main ~ master # salt --versions
Salt: 2014.7.0
Python: 2.7.8 (default, Oct 18 2014, 12:50:18)
Jinja2: 2.7.3
M2Crypto: 0.21.1
msgpack-python: 0.4.2
msgpack-pure: Not Installed
pycrypto: 2.6.1
libnacl: Not Installed
PyYAML: 3.11
ioflo: Not Installed
PyZMQ: 14.4.0
RAET: Not Installed
ZMQ: 4.0.5
Mako: 1.0.0
I'm experiencing the same issue. Works in my python test script, but not when using pillar.items across different environments. It does work for me if I move everything into the same pillar sls file though...
root@vagrant-ubuntu-trusty-64:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.1 LTS
Release: 14.04
Codename: trusty
root@vagrant-ubuntu-trusty-64:~#
root@vagrant-ubuntu-trusty-64:~# salt-call --versions
Salt: 2014.7.0
Python: 2.7.6 (default, Mar 22 2014, 22:59:56)
Jinja2: 2.7.2
M2Crypto: 0.21.1
msgpack-python: 0.3.0
msgpack-pure: Not Installed
pycrypto: 2.6.1
libnacl: Not Installed
PyYAML: 3.10
ioflo: Not Installed
PyZMQ: 14.0.1
RAET: Not Installed
ZMQ: 4.0.4
Mako: 0.9.1
changed the title [-]yamlex !reset doesn't work in pillar config files - does work on command line[/-][+]yamlex !reset doesn't work when combining pillars across environments[/+]on Feb 9, 2015
Running into this same issue on the latest salt when using !reset with multiple sls files. I have pillar_source_merging_strategy set to aggregate, but haven't made any other changes to the packaged /etc/salt/master. Here's what I'm trying to do:
$ salt-call --versions
Salt: 2015.5.0
Python: 2.7.6 (default, Mar 22 2014, 22:59:56)
Jinja2: 2.7.2
M2Crypto: 0.21.1
msgpack-python: 0.3.0
msgpack-pure: Not Installed
pycrypto: 2.6.1
libnacl: Not Installed
PyYAML: 3.10
ioflo: Not Installed
PyZMQ: 14.0.1
RAET: Not Installed
ZMQ: 4.0.4
Mako: 0.9.1
Debian source package: 2015.5.0+ds-1trusty1
Really hoping I'm not trying to misuse this feature as I would love to have the flexibility of something like hiera without configuring an extension. It seems like I could get this working by using jinja|yamlex with jinja includes to build a single sls file. Maybe that would be a better way to go?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.
Corerelates to code central or existential to SaltP4Priority 4Pillarbugbroken, incorrect, or confusing behaviorseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work aroundstale
Activity
jfindlay commentedon Dec 4, 2014
@wickedbill, I am unable to reproduce this bug. I'm not sure how yamlex is
being disabled on your system. This is what I did, please comment if I have
done something wrong.
setup
execution
inthecloud247 commentedon Dec 23, 2014
I'm experiencing the same issue. Works in my python test script, but not when using pillar.items across different environments. It does work for me if I move everything into the same pillar sls file though...
inthecloud247 commentedon Dec 23, 2014
I just found that by setting the option "pillar_source_merging_strategy: aggregate" in my master.conf file, aggregation worked almost as expected. the 'reset' still didn't work entirely correctly, but it did seem better. http://docs.saltstack.com/en/latest/ref/configuration/master.html#pillar-source-merging-strategy
[-]yamlex !reset doesn't work in pillar config files - does work on command line[/-][+]yamlex !reset doesn't work when combining pillars across environments[/+]quixoten commentedon May 12, 2015
Running into this same issue on the latest salt when using
!resetwith multiple sls files. I havepillar_source_merging_strategyset toaggregate, but haven't made any other changes to the packaged/etc/salt/master. Here's what I'm trying to do:And here's the actual result
And here's the expected result:
Version info:
Really hoping I'm not trying to misuse this feature as I would love to have the flexibility of something like hiera without configuring an extension. It seems like I could get this working by using
jinja|yamlexwith jinja includes to build a single sls file. Maybe that would be a better way to go?quixoten commentedon May 12, 2015
UPDATE: I was able to get the functionality I'm after by using jinja includes, i.e,
This gives the respected result, i.e.,
stale commentedon Nov 10, 2017
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.