Regression in pillar under 2014.1.11
This problem was initially reported (and debugged) on irc with babilen.
The problem is whereas pillar is defined (and correctly readed, without errors), pillar.items is empty. The pillar don't work under 2014.1.11 (whereas it is ok under 2014.1.10).
The configuration is masterless, run with unpriviliged user. (My purpose is just to test salt for the moment).
Execution tests
$ salt-call --versions-report
Salt: 2014.1.11
Python: 2.7.8 (default, Sep 23 2014, 11:38:08)
Jinja2: 2.7.3
M2Crypto: 0.22
msgpack-python: 0.4.2
msgpack-pure: Not Installed
pycrypto: 2.6.1
PyYAML: 3.11
PyZMQ: 14.3.1
ZMQ: 4.0.4
$ salt-call pillar.get hello no-value -c /tmp/salt/etc/salt
local:
no-value
(switching to 2014.1.10)
$ salt-call --versions-report
Salt: 2014.1.10
Python: 2.7.8 (default, Sep 23 2014, 11:38:08)
Jinja2: 2.7.3
M2Crypto: 0.22
msgpack-python: 0.4.2
msgpack-pure: Not Installed
pycrypto: 2.6.1
PyYAML: 3.11
PyZMQ: 14.3.1
ZMQ: 4.0.4
$ salt-call pillar.get hello no-value -c /tmp/salt/etc/salt
local:
world
Here the salt files description:
List of files for salt:
There are based at "/tmp/salt"
$ find . -type f
./etc/salt/minion_id
./etc/salt/minion.d/masterless.conf
./etc/salt/minion.d/paths.conf
./var/salt/states/top.sls
./var/salt/states/test.sls
./var/salt/pillar/test.sls
./var/salt/pillar/top.sls
Configuration contents:
$ cat ./etc/salt/minion.d/masterless.conf
file_client: local
$ cat ./etc/salt/minion.d/paths.conf
root_dir: /tmp/salt
file_roots:
base:
- /tmp/salt/var/salt/states
pillar_roots:
base:
- /tmp/salt/var/salt/pillar
State files contents:
$ cat ./var/salt/states/top.sls
base:
'*':
- test
$ cat ./var/salt/states/test.sls
test:
file.managed:
- name: /tmp/test
- contents: "this is just a test on {{ grains['os'] }}: hello {{ salt['pillar.get']('hello', 'no world') }}"
Pillar files contents:
$ cat ./var/salt/pillar/top.sls
base:
'*':
- test
$ cat ./var/salt/pillar/test.sls
hello: world
Debugging
I have bisect to the first commit which introduce that bad behaviour: 280e1fe4500d2145d16b1d92c9f4053b78863235 (but I have to comment line 21: "from salt.utils.serializers.yamlex import merge_recursive" (No module named serializers.yamlex)).
I currently look at the commit.
There problem is in ext_pillar function (salt/pillar/init.py).
The function merge pillar and external data coming from ext_pillar (but the documentation say only it render external pillar data ?).
But if there is not ext_pillar defined, the function return {}, instead of the local pillar data.
Is this an issue in the 2014.7 or develop branches? We've already cut 2014.1.11 and do not expect to cut any more 2014.1 releases.
@basepi this issue is only for 2014.1. I have tested it against 2014.7 (2014.7.0rc2-486-g60770cf) and develop (2014.7.0-723-g3e204c1) without trigger the problem.
It might be an option to patch this in the packages directly if there are no plans for, yet, another 2014.1 release.
@semarie @babilen So let me get this straight -- if external pillar is not defined, then pillar ends up empty? If we can reproduce this, we may cut a .12, because that would be a critical bug.
I cannot reproduce this issue. I installed 2014.1.11, ensured that I wasn't using external pillar, changed a value in my pillar data, synced it, and it showed up in pillar.items. I haven't yet tested with a state, but you mentioned an empty pillar.items so I figured that was enough for the moment. Can you clue me in on what I might be doing wrong?
@basepi Does your test is in masterless configuration ? I have only tested it without master. And yes, it is not necessary to have a state, just calling pillar.items (or pillar.get) is enought.
You could use this test script, which build a full environnement that reproduce the problem.
Please configure at least the PYTHON variable.
The result should be:
- "world" if problem not reproduced
- "no-value" if problem reproduced
#!/bin/sh
PYTHON=python2.7
TESTDIR="/tmp/salt-test-pillar"
exec 2>&1
test -n "${DEBUG}" && set -x
# make test directory
mkdir -p "${TESTDIR}"
cd "${TESTDIR}"
# fork salt in salt-repo
if [ ! -d salt-repo ] ; then
git clone https://github.com/saltstack/salt.git salt-repo
fi
# configure salt to follow 2014.1
( cd salt-repo && git checkout 2014.1 )
# build a test environnement
mkdir -p etc/salt var/salt/{pillar,states}
cat >etc/salt/minion <<EOF
file_client: local
ipc_mode: tcp
pillar_opts: False
root_dir: ${TESTDIR}
file_roots:
base:
- ${TESTDIR}/var/salt/states
pillar_roots:
base:
- ${TESTDIR}/var/salt/pillar
EOF
cat >var/salt/pillar/top.sls <<EOF
base:
'*':
- test
EOF
cat >var/salt/pillar/test.sls <<EOF
hello: world
EOF
# clean cache, log, and pyc
rm -rf var/{cache,log}
find salt-repo -name '*.pyc' -type f -print0 | xargs -0 rm
# verify version
echo '$ salt-call --versions-report'
PYTHONPATH="${TESTDIR}/salt-repo" "${PYTHON}" salt-repo/scripts/salt-call --versions-report
# test pillar
echo '$' "salt-call pillar.get hello no-value -c ${TESTDIR}/etc/salt"
PYTHONPATH="${TESTDIR}/salt-repo" "${PYTHON}" salt-repo/scripts/salt-call pillar.get hello no-value -c "${TESTDIR}/etc/salt"
Ah, I was testing with a master. I'll try to reproduce without a master.
So in masterless, I don't see an empty pillar, but it appears to be limited just to master config (likely leftover from when it was connected to the master). My custom key does not appear. So I guess I can reproduce this issue.
That said, because this only appears in masterless, I think we are still not going to do a 2014.1.12, with 2014.7.0 so close to release. We will still accept your pull request, however, so if you want to stay on 2014.1, you can bootstrap from that branch.
Thanks for have merged the pull-request.
This is a fatal bug for me with the new version of salt. We've been running masterless for a long time, and I don't want to go back.
breaks tons of automated testing for formulas where we are using the vagrant salt-provisioner. This is a critical bug. Please re-open!!!
If you are not going todo another release for 2014.1, you should either patch 2014.1.11, or remove 2014.1.11 from your repo and leave 2014.1.10
@stevendgonzales Well, it's fixed in 2014.1 in any case, so I'm not going to re-open. We will likely cut a 2014.1.12, let me ping the other devs and discuss it.
@basepi Thank you, I appreciate it
If you use vagrant you can solve it using this conf:
config.vm.provision :salt do |salt|
salt.minion_config = "vagrant/minion"
salt.run_highstate = true
salt.install_type = "git"
salt.install_args = "v2014.1.10"
salt.verbose = true
end
I would +1 a 2014.1.12
We have already cut an internal 2014.1.12 and are testing before release. Sorry for the inconvenience this has caused.
Perfect, thank you!
Awesome @basepi, can we expect this soon?
@PHLAK, he mentions in https://github.com/saltstack/salt/issues/16416 that they are currently testing 2014.1.12 for a potential build next week.