salt state.apply gives the following error:
Traceback (most recent call last):
File "/usr/bin/salt-call", line 11, in <module>
salt_call()
File "/usr/lib/python2.7/site-packages/salt/scripts.py", line 349, in salt_call
client.run()
File "/usr/lib/python2.7/site-packages/salt/cli/call.py", line 48, in run
caller = salt.cli.caller.Caller.factory(self.config)
File "/usr/lib/python2.7/site-packages/salt/cli/caller.py", line 79, in factory
return ZeroMQCaller(opts, **kwargs)
File "/usr/lib/python2.7/site-packages/salt/cli/caller.py", line 274, in __init__
super(ZeroMQCaller, self).__init__(opts)
File "/usr/lib/python2.7/site-packages/salt/cli/caller.py", line 102, in __init__
self.minion = salt.minion.SMinion(opts)
File "/usr/lib/python2.7/site-packages/salt/minion.py", line 594, in __init__
opts['grains'] = salt.loader.grains(opts)
File "/usr/lib/python2.7/site-packages/salt/loader.py", line 702, in grains
ret = fun()
File "/usr/lib/python2.7/site-packages/salt/grains/core.py", line 1756, in dns
resolv = salt.utils.dns.parse_resolv()
File "/usr/lib/python2.7/site-packages/salt/utils/dns.py", line 32, in parse_resolv
search = list(itertools.takewhile(
AttributeError: 'module' object has no attribute 'takewhile'
salt version : 2016.3.0rc3.2229.gbc0f902-1
build saltstack from develop branch,
run salt-call sys.doc or salt-call state.apply
can't run version report, same message
running develop from commit: 788557851937bba762dd7efbb85eec2ea11d23e5
@aboe76 I can't reproduce this.
This function has been present (in itertools) since Python 2.4. Did you have a prior install from git already? Sometimes problems like this can be caused by stale .pyc files.
I'm getting this as well on the develop branch. I spun a new instance in AWS this morning, installed salt using the bootstrap, and I'm getting this error on most anything I do.
# salt-call --local cmd.run 'echo test'
[ERROR ] An un-handled exception was caught by salt's global exception handler:
AttributeError: 'module' object has no attribute 'takewhile'
Traceback (most recent call last):
File "/usr/bin/salt-call", line 11, in <module>
salt_call()
File "/usr/lib/python2.6/site-packages/salt/scripts.py", line 349, in salt_call
client.run()
File "/usr/lib/python2.6/site-packages/salt/cli/call.py", line 48, in run
caller = salt.cli.caller.Caller.factory(self.config)
File "/usr/lib/python2.6/site-packages/salt/cli/caller.py", line 79, in factory
return ZeroMQCaller(opts, **kwargs)
File "/usr/lib/python2.6/site-packages/salt/cli/caller.py", line 274, in __init__
super(ZeroMQCaller, self).__init__(opts)
File "/usr/lib/python2.6/site-packages/salt/cli/caller.py", line 102, in __init__
self.minion = salt.minion.SMinion(opts)
File "/usr/lib/python2.6/site-packages/salt/minion.py", line 594, in __init__
opts['grains'] = salt.loader.grains(opts)
File "/usr/lib/python2.6/site-packages/salt/loader.py", line 702, in grains
ret = fun()
File "/usr/lib/python2.6/site-packages/salt/grains/core.py", line 1756, in dns
resolv = salt.utils.dns.parse_resolv()
File "/usr/lib/python2.6/site-packages/salt/utils/dns.py", line 32, in parse_resolv
search = list(itertools.takewhile(
AttributeError: 'module' object has no attribute 'takewhile'
Traceback (most recent call last):
File "/usr/bin/salt-call", line 11, in <module>
salt_call()
File "/usr/lib/python2.6/site-packages/salt/scripts.py", line 349, in salt_call
client.run()
File "/usr/lib/python2.6/site-packages/salt/cli/call.py", line 48, in run
caller = salt.cli.caller.Caller.factory(self.config)
File "/usr/lib/python2.6/site-packages/salt/cli/caller.py", line 79, in factory
return ZeroMQCaller(opts, **kwargs)
File "/usr/lib/python2.6/site-packages/salt/cli/caller.py", line 274, in __init__
super(ZeroMQCaller, self).__init__(opts)
File "/usr/lib/python2.6/site-packages/salt/cli/caller.py", line 102, in __init__
self.minion = salt.minion.SMinion(opts)
File "/usr/lib/python2.6/site-packages/salt/minion.py", line 594, in __init__
opts['grains'] = salt.loader.grains(opts)
File "/usr/lib/python2.6/site-packages/salt/loader.py", line 702, in grains
ret = fun()
File "/usr/lib/python2.6/site-packages/salt/grains/core.py", line 1756, in dns
resolv = salt.utils.dns.parse_resolv()
File "/usr/lib/python2.6/site-packages/salt/utils/dns.py", line 32, in parse_resolv
search = list(itertools.takewhile(
AttributeError: 'module' object has no attribute 'takewhile'
# salt-call --versions
Salt Version:
Salt: 2016.3.0rc3-2229-gbc0f902
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: Not Installed
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
Jinja2: 2.7.3
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: 0.20.2
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.6
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pygit2: Not Installed
Python: 2.6.6 (r266:84292, Jul 23 2015, 15:22:56)
python-gnupg: Not Installed
PyYAML: 3.11
PyZMQ: 14.5.0
RAET: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.0.5
System Versions:
dist: centos 6.8 Final
machine: x86_64
release: 2.6.32-642.1.1.el6.x86_64
system: Linux
version: CentOS 6.8 Final
I can reproduce.
root@ubuntu-master:~/salt# /usr/local/bin/salt-master --versions-report
Salt Version:
Salt: 2016.3.0-677-g1e49976
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 1.5
gitdb: 0.5.4
gitpython: 0.3.2 RC1
ioflo: Not Installed
Jinja2: 2.7.2
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: 0.9.1
msgpack-pure: Not Installed
msgpack-python: 0.3.0
mysql-python: 1.2.3
pycparser: Not Installed
pycrypto: 2.6.1
pygit2: Not Installed
Python: 2.7.6 (default, Jun 22 2015, 17:58:13)
python-gnupg: Not Installed
PyYAML: 3.10
PyZMQ: 14.0.1
RAET: Not Installed
smmap: 0.8.2
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.0.4
System Versions:
dist: Ubuntu 14.04 trusty
machine: x86_64
release: 3.13.0-87-generic
system: Linux
version: Ubuntu 14.04 trust
I installed from a local git clone
@terminalmage can the label 'Cannot Reproduce' be removed?
The problem is that because the utils/dns.py file is in the same directory as a file name itertools.py.
Because of this python is using implicit relative imports instead of importing the standard itertools.
You can force a file to use absolute imports by including the following line at the top of the file:
from __future__ import absolute_import
The disabled pylint warning was a tip off,
Good catch, it turns out I was unable to reproduce because I tested on Python 2.7, derp. I opened #33871 to fix this.
I can confirm that fixes it for me as well. Thanks!
@terminalmage, @richardscollin thanks for the quick fix, I can confirm saltstack is working again.
Most helpful comment
The problem is that because the utils/dns.py file is in the same directory as a file name itertools.py.
Because of this python is using implicit relative imports instead of importing the standard itertools.
You can force a file to use absolute imports by including the following line at the top of the file:
from __future__ import absolute_importThe disabled pylint warning was a tip off,