pecl.installed errors on KeyError: 'pecl.installed'
When running highstate we get the following error:
The minion function caused an exception: Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/salt/minion.py", line 1161, in _thread_r
return_data = func(*args, **kwargs)
File "/usr/lib/python2.6/site-packages/salt/modules/state.py", line 523, in hig
whitelist=kwargs.get('whitelist')
File "/usr/lib/python2.6/site-packages/salt/state.py", line 2968, in call_highs
return self.state.call_high(high)
File "/usr/lib/python2.6/site-packages/salt/state.py", line 2067, in call_high
ret = dict(list(disabled.items()) + list(self.call_chunks(chunks).items()))
File "/usr/lib/python2.6/site-packages/salt/state.py", line 1623, in call_chunk
running = self.call_chunk(low, running, chunks)
File "/usr/lib/python2.6/site-packages/salt/state.py", line 1769, in call_chunk
self._mod_init(low)
File "/usr/lib/python2.6/site-packages/salt/state.py", line 612, in _mod_init
self.states['{0}.{1}'.format(low['state'], low['fun'])] # pylint: disable=W0
File "/usr/lib/python2.6/site-packages/salt/utils/lazy.py", line 90, in __getit
raise KeyError(key)
KeyError: 'pecl.installed'
It seems to be failing on:
pecl-memcached:
pecl.installed:
- version: 2.2.0
- defaults: True
- name: memcached
[root@salt-pre-production-master-i-a7c14406 ~]# salt --versions-report
Salt: 2015.5.3
Python: 2.6.6 (r266:84292, Jul 23 2015, 15:22:56)
Jinja2: 2.2.1
M2Crypto: 0.20.2
msgpack-python: 0.4.6
msgpack-pure: Not Installed
pycrypto: 2.0.1
libnacl: Not Installed
PyYAML: 3.10
ioflo: Not Installed
PyZMQ: 14.3.1
RAET: Not Installed
ZMQ: 3.2.5
Mako: Not Installed
Tornado: Not Installed
[root@salt-pre-production-master-i-a7c14406 ~]# cat /proc/version
Linux version 2.6.32-431.3.1.el6.x86_64 ([email protected]) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC) ) #1 SMP Fri Jan 3 21:39:27 UTC 2014
I'm having the same issue but with git.latest:
2015-08-13 11:59:07,194 [salt.utils.lazy ][DEBUG ][9807] LazyLoaded git.latest
2015-08-13 11:59:07,194 [salt.minion ][WARNING ][9807] The minion function caused an exception
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/salt/minion.py", line 1161, in _thread_return
return_data = func(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/salt/modules/state.py", line 523, in highstate
whitelist=kwargs.get('whitelist')
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 2968, in call_highstate
return self.state.call_high(high)
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 2067, in call_high
ret = dict(list(disabled.items()) + list(self.call_chunks(chunks).items()))
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1623, in call_chunks
running = self.call_chunk(low, running, chunks)
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1858, in call_chunk
running = self.call_chunk(chunk, running, chunks)
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1858, in call_chunk
running = self.call_chunk(chunk, running, chunks)
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1769, in call_chunk
self._mod_init(low)
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 612, in _mod_init
self.states['{0}.{1}'.format(low['state'], low['fun'])] # pylint: disable=W0106
File "/usr/lib/python2.7/dist-packages/salt/utils/lazy.py", line 87, in __getitem__
return self._dict[key]
KeyError: 'git.latest'
2015-08-13 11:59:07,194 [salt.utils.event ][DEBUG ][9807] SaltEvent PUB socket URI: ipc:///var/run/salt/minion/minion_event_7281a3b75b_pub.ipc
2015-08-13 11:59:07,194 [salt.utils.event ][DEBUG ][9807] SaltEvent PULL socket URI: ipc:///var/run/salt/minion/minion_event_7281a3b75b_pull.ipc
2015-08-13 11:59:07,194 [salt.utils.event ][DEBUG ][9807] Sending event - data = {'_stamp': '2015-08-13T11:59:07.194407'}
2015-08-13 11:59:07,195 [salt.minion ][DEBUG ][7657] Handling event 'salt/event/new_client\n\n\x81\xa6_stamp\xba2015-08-13T11:59:07.194407'
2015-08-13 11:59:07,195 [salt.utils.event ][DEBUG ][9807] Sending event - data = {'message': u'The minion function caused an exception', 'args': ('The minion function caused an exception',), '_stamp': '2015-08-13T11:59:07.195306'}
2015-08-13 11:59:07,196 [salt.minion ][DEBUG ][7657] Handling event "_salt_error\n\n\x83\xa7message\xda\x00'The minion function caused an exception\xa4args\x91\xda\x00'The minion function caused an exception\xa6_stamp\xba2015-08-13T11:59:07.195306"
2015-08-13 11:59:07,196 [salt.minion ][DEBUG ][7657] Forwarding salt error event tag=_salt_error
2015-08-13 11:59:07,196 [salt.crypt ][DEBUG ][7657] Re-using SAuth for ('/etc/salt/pki/minion', 'ip-10-0-2-27.ec2.internal', 'tcp://10.0.1.5:4506')
2015-08-13 11:59:07,222 [salt.minion ][INFO ][9807] Returning information for job: 20150813115825886251
2015-08-13 11:59:07,222 [salt.crypt ][DEBUG ][9807] Re-using SAuth for ('/etc/salt/pki/minion', 'ip-10-0-2-27.ec2.internal', 'tcp://10.0.1.5:4506')
Salt: 2015.5.3
Python: 2.7.3 (default, Mar 13 2014, 11:03:55)
Jinja2: 2.6
M2Crypto: 0.21.1
msgpack-python: 0.1.10
msgpack-pure: Not Installed
pycrypto: 2.6
libnacl: Not Installed
PyYAML: 3.10
ioflo: Not Installed
PyZMQ: 13.1.0
RAET: Not Installed
ZMQ: 3.2.3
Mako: Not Installed
Tornado: Not Installed
Debian source package: 2015.5.3+ds-1~bpo70+2
My state is the following:
platform-code:
git.latest:
- name: {{ salt['pillar.get']('sourcecode:lookup:config:repository') }}
- rev: {{ salt['pillar.get']('sourcecode:lookup:config:branch') }}
- target: {{ salt['pillar.get']('sourcecode:lookup:config:target') }}
- user: {{ nginx.www_user }}
- force_checkout: True
- force_reset: True
- require:
- pkg: git
- pkg: nginx
- file: {{ salt['pillar.get']('sourcecode:lookup:config:rootdir') }}/.ssh/known_hosts
- file: {{ salt['pillar.get']('sourcecode:lookup:config:rootdir') }}/.ssh/id_rsa
- file: {{ salt['pillar.get']('sourcecode:lookup:config:target') }}
- watch_in:
- service: {{ php.php_fpm_service }}
I'm pretty sure that this did not happen on prior versions of 2015.5.3 on Debian because the same state worked. Will try to check which version it was and come back with that.
Thanks!
I can confirm this ~~don't~~ happens in 2015.8 git branch installed with bootstrap.
PS: I rushed when testing.
@amontalban Could you please open a separate issue? That appears unrelated to the original issue here. Thanks.
@markfrancis905 What does which pecl return on your system when run as the same user that the salt-minion is running under?
@cachedout I think this is somehow related, my theory is that the pecl and git modules failed because the binaries weren't installed (Besides I had requirements for them). I've tried a similar state and failed as well:
php-opcache:
pecl.installed:
- name: zendopcache
- watch:
- pkg: php-pear
- pkg: php-dev
- pkg: php-cli
- pkg: build-essential
And failed with this error:
2015-08-13 18:16:56,601 [salt.utils.lazy ][DEBUG ][26545] LazyLoaded pecl.installed
2015-08-13 18:16:56,601 [salt.log.setup ][ERROR ][26545] An un-handled exception was caught by salt's global exception handler:
KeyError: 'pecl.installed'
Traceback (most recent call last):
File "/usr/bin/salt-call", line 11, in <module>
salt_call()
File "/usr/lib/python2.7/dist-packages/salt/scripts.py", line 227, in salt_call
client.run()
File "/usr/lib/python2.7/dist-packages/salt/cli/call.py", line 69, in run
caller.run()
File "/usr/lib/python2.7/dist-packages/salt/cli/caller.py", line 236, in run
ret = self.call()
File "/usr/lib/python2.7/dist-packages/salt/cli/caller.py", line 138, in call
ret['return'] = func(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/salt/modules/state.py", line 523, in highstate
whitelist=kwargs.get('whitelist')
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 2968, in call_highstate
return self.state.call_high(high)
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 2067, in call_high
ret = dict(list(disabled.items()) + list(self.call_chunks(chunks).items()))
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1623, in call_chunks
running = self.call_chunk(low, running, chunks)
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1769, in call_chunk
self._mod_init(low)
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 612, in _mod_init
self.states['{0}.{1}'.format(low['state'], low['fun'])] # pylint: disable=W0106
File "/usr/lib/python2.7/dist-packages/salt/utils/lazy.py", line 87, in __getitem__
return self._dict[key]
KeyError: 'pecl.installed'
In my case the pkg-cli package was failing, so it seems it doesn't handle the failure properly.
Hope it sounds clear.
Thanks!
@cachedout I think this was introduced in be18439736d8c9e247fed3929365ad3d6148d045 by @jacksontj (I have tested versions prior to that commit and worked, like for example 378f6bfc36646ec229b766dc22e1fcc12c14d548).
Just in case this is the list of commits between above commits just in case: https://github.com/saltstack/salt/compare/378f6bfc36646ec229b766dc22e1fcc12c14d548...be18439736d8c9e247fed3929365ad3d6148d045
Hope this helps you guys out to get this sorted out.
Thanks!
@cachedout [root@XXXXXXX-i-93bd596a ~]# which pecl /opt/rh/php55/root/usr/bin/pecl
Happened for me with ipset.present on 2015.5.3:
Traceback (most recent call last):
File "/usr/local/bin/salt-call", line 9, in <module>
load_entry_point('salt==2015.5.3', 'console_scripts', 'salt-call')()
File "/usr/local/salt/virtualenv/lib/python2.7/site-packages/salt/scripts.py", line 227, in salt_call
client.run()
File "/usr/local/salt/virtualenv/lib/python2.7/site-packages/salt/cli/call.py", line 69, in run
caller.run()
File "/usr/local/salt/virtualenv/lib/python2.7/site-packages/salt/cli/caller.py", line 236, in run
ret = self.call()
File "/usr/local/salt/virtualenv/lib/python2.7/site-packages/salt/cli/caller.py", line 138, in call
ret['return'] = func(*args, **kwargs)
File "/usr/local/salt/virtualenv/lib/python2.7/site-packages/salt/modules/state.py", line 523, in highstate
whitelist=kwargs.get('whitelist')
File "/usr/local/salt/virtualenv/lib/python2.7/site-packages/salt/state.py", line 2968, in call_highstate
return self.state.call_high(high)
File "/usr/local/salt/virtualenv/lib/python2.7/site-packages/salt/state.py", line 2067, in call_high
ret = dict(list(disabled.items()) + list(self.call_chunks(chunks).items()))
File "/usr/local/salt/virtualenv/lib/python2.7/site-packages/salt/state.py", line 1623, in call_chunks
running = self.call_chunk(low, running, chunks)
File "/usr/local/salt/virtualenv/lib/python2.7/site-packages/salt/state.py", line 1858, in call_chunk
running = self.call_chunk(chunk, running, chunks)
File "/usr/local/salt/virtualenv/lib/python2.7/site-packages/salt/state.py", line 1769, in call_chunk
self._mod_init(low)
File "/usr/local/salt/virtualenv/lib/python2.7/site-packages/salt/state.py", line 612, in _mod_init
self.states['{0}.{1}'.format(low['state'], low['fun'])] # pylint: disable=W0106
File "/usr/local/salt/virtualenv/lib/python2.7/site-packages/salt/utils/lazy.py", line 87, in __getitem__
return self._dict[key]
KeyError: 'ipset.present'
After commenting out be18439736d8c9e247fed3929365ad3d6148d045 higstate finished successfully.
Same for me with npm.installed on 2015.5.3:
The minion function caused an exception: Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/salt/minion.py", line 1161, in _thread_return
return_data = func(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/salt/modules/state.py", line 523, in highstate
whitelist=kwargs.get('whitelist')
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 2968, in call_highstate
return self.state.call_high(high)
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 2067, in call_high
ret = dict(list(disabled.items()) + list(self.call_chunks(chunks).items()))
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1623, in call_chunks
running = self.call_chunk(low, running, chunks)
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1858, in call_chunk
running = self.call_chunk(chunk, running, chunks)
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1858, in call_chunk
running = self.call_chunk(chunk, running, chunks)
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1858, in call_chunk
running = self.call_chunk(chunk, running, chunks)
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1769, in call_chunk
self._mod_init(low)
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 612, in _mod_init
self.states['{0}.{1}'.format(low['state'], low['fun'])] # pylint: disable=W0106
File "/usr/lib/python2.7/dist-packages/salt/utils/lazy.py", line 90, in __getitem__
raise KeyError(key)
KeyError: 'npm.installed'
Sorry about the delay-- just catching up after vacation :)
So, I took a look into this and the stack traces and I'm actually more confused ;)
So I made the following SLS for testing (since @amontalban mentioned git repros the issue)
https://github.com/saltstack/salt.git:
git.latest:
- rev: develop
- target: /tmp/salt
With that I'm unable to reproduce this issue. From looking at the trace it looks like self.states (which is the states loader) is saying that the function you want (git.latest in that case) isn't there. I'm not sure how commenting out the line would fix that-- since it should just fail when it gets to that same line latter in the code. When you guys comment out the line does your state complete? Or does it have errors (which is understandably better than stack traces ;) ). If not, can you guys paste me a more-or-less contained SLS to repro this? BTW I'm testing this against the 2015.5 branch-- since thats when this patch was introduced.
@jacksontj I think it fails when the required binary does not exists. In this case git.
Can you try to uninstall git and execute this SLS?
git:
pkg.installed
https://github.com/saltstack/salt.git:
git.latest:
- rev: develop
- target: /tmp/salt
- require:
- pkg: git
Thank you!
Ok, that makses sense-- so for the failures the difference is errord state return and stacktrace, right? If so, thats an easy fix :)
On Wed, Sep 2, 2015 at 9:44 AM, Andres Montalban [email protected] wrote:
@jacksontj https://github.com/jacksontj I think it fails when the required binary does not exists. In this case git.
Can you try to uninstall git and execute this SLS?
git: pkg.installed https://github.com/saltstack/salt.git: git.latest: - rev: develop - target: /tmp/salt - require: - pkg: git
Thank you!
— Reply to this email directly or view it on GitHub https://github.com/saltstack/salt/issues/26280#issuecomment-137164980.
Awesome, looking forward for it since I'm stuck in git v2015.5.2 right now :)
Hmm, even after removing git I don't get any backtraces-- it just works as expected :/
I get the same error with a custom ZFS state module. The module seems to be loaded before the ZFS binaries are installed.
I tried on 2015.5.3 and 2015.5.5.
Here is the error from the 2015.5.5 minion:
The minion function caused an exception: Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/salt/minion.py", line 1173, in _thread_return
return_data = func(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/salt/modules/state.py", line 538, in highstate
whitelist=kwargs.get('whitelist')
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 2986, in call_highstate
return self.state.call_high(high)
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 2068, in call_high
ret = dict(list(disabled.items()) + list(self.call_chunks(chunks).items()))
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1624, in call_chunks
running = self.call_chunk(low, running, chunks)
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1770, in call_chunk
self._mod_init(low)
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 613, in _mod_init
self.states['{0}.{1}'.format(low['state'], low['fun'])] # pylint: disable=W0106
File "/usr/lib/python2.7/dist-packages/salt/utils/lazy.py", line 90, in __getitem__
raise KeyError(key)
KeyError: 'zpool.create'
This issue seems to be a duplicate of #26882.
Hi @jacksontj,
Sorry for the delay, I was trying to find out a way to reproduce this in a clear manner.
This is a Dockerfile for v2015.5.2:
FROM debian:wheezy
RUN apt-get update
RUN apt-get -y upgrade
RUN apt-get -y install curl procps man-db build-essential apt-utils
RUN /usr/bin/curl -L https://bootstrap.saltstack.com -o install_salt.sh
RUN sh install_salt.sh -L -U -X -P -G -D -d git v2015.5.2
RUN mkdir -p /srv/salt && cd /srv/salt
RUN wget -O /srv/salt/test.sls https://gist.githubusercontent.com/amontalban/975225acc7a1e59f0229/raw/6588181796cbba4b94b772181ce0c06c23284a43/test.sls
This is a Dockerfile for v2015.5.3:
FROM debian:wheezy
RUN apt-get update
RUN apt-get -y upgrade
RUN apt-get -y install curl procps man-db build-essential apt-utils
RUN /usr/bin/curl -L https://bootstrap.saltstack.com -o install_salt.sh
RUN sh install_salt.sh -L -U -X -P -G -D -d git v2015.5.3
RUN mkdir -p /srv/salt && cd /srv/salt
RUN wget -O /srv/salt/test.sls https://gist.githubusercontent.com/amontalban/975225acc7a1e59f0229/raw/6588181796cbba4b94b772181ce0c06c23284a43/test.sls
You can build those images and then connect to it:
docker run -t -i debian_salt_v2015.5.2 /bin/bash
And run the state:
salt-call -l all --local state.apply test
The state is the following:
php-dev:
pkg.installed:
- name: php5-dev
php-cli:
pkg.installed:
- name: php5-cli
build-essential:
pkg.installed: []
php-opcache:
pecl.installed:
- name: zendopcache
- watch:
- pkg: php-dev
- pkg: php-cli
- pkg: build-essential
In v2015.5.2 it fails "gently" while in v2015.5.3 with same state it gives an exception.
Let me know if you need anything else.
Thanks!
For the record, we updated the salt master to 2015.5.5 and still get this error:
The minion function caused an exception: Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/salt/minion.py", line 1161, in _thread_return
return_data = func(*args, **kwargs)
File "/usr/lib/python2.6/site-packages/salt/modules/state.py", line 523, in highstate
whitelist=kwargs.get('whitelist')
File "/usr/lib/python2.6/site-packages/salt/state.py", line 2968, in call_highstate
return self.state.call_high(high)
File "/usr/lib/python2.6/site-packages/salt/state.py", line 2067, in call_high
ret = dict(list(disabled.items()) + list(self.call_chunks(chunks).items()))
File "/usr/lib/python2.6/site-packages/salt/state.py", line 1623, in call_chunks
running = self.call_chunk(low, running, chunks)
File "/usr/lib/python2.6/site-packages/salt/state.py", line 1769, in call_chunk
self._mod_init(low)
File "/usr/lib/python2.6/site-packages/salt/state.py", line 612, in _mod_init
self.states['{0}.{1}'.format(low['state'], low['fun'])] # pylint: disable=W0106
File "/usr/lib/python2.6/site-packages/salt/utils/lazy.py", line 90, in __getitem__
raise KeyError(key)
KeyError: 'pecl.installed'
[root@salt-master-i-89d9e96e salt]# salt --versions-report
Salt: 2015.5.5
Python: 2.6.6 (r266:84292, Nov 22 2013, 12:16:22)
Jinja2: 2.2.1
M2Crypto: 0.20.2
msgpack-python: 0.4.6
msgpack-pure: Not Installed
pycrypto: 2.0.1
libnacl: Not Installed
PyYAML: 3.10
ioflo: Not Installed
PyZMQ: 14.3.1
RAET: Not Installed
ZMQ: 3.2.5
Mako: Not Installed
Tornado: Not Installed
timelib: Not Installed
dateutil: 2.1
@jacksontj did you have time to test the Docker images I sent? Thanks!
FWIW, #26882 is likely a duplicate of this issue, and is exposing itself via npm instead of pecl or git as described here. I reported in my comment that I can reproduce the error at the HEAD of the 2015.5 branch, but is fixed on 2015.8.0.
Is anyone seeing similar results to this as well?