Open balrawat opened 5 years ago
It occurs during a module refresh after any change happens.
[INFO ] Made the following changes:
'bzip2' changed from 'absent' to '1.0.6-13.el7'
[DEBUG ] Refreshing modules...
[INFO ] Loading fresh modules for state activity
[DEBUG ] LazyLoaded jinja.render
[DEBUG ] LazyLoaded yaml.render
[INFO ] Completed state [bzip2] at time 18:09:06.789075 (duration_in_ms=13877.258)
[DEBUG ] LazyLoaded config.option
[DEBUG ] LazyLoaded pkg.install
[DEBUG ] LazyLoaded pkg.installed
[INFO ] Running state [gcc-c++] at time 18:09:06.810082
[INFO ] Executing state pkg.installed for [gcc-c++]
[DEBUG ] key: ifttt.secret_key, ret: _|-
[DEBUG ] key: ifttt:secret_key, ret: _|-
[DEBUG ] key: pushbullet.api_key, ret: _|-
[DEBUG ] key: pushbullet:api_key, ret: _|-
[DEBUG ] LazyLoaded systemd.booted
**[DEBUG ] Error loading module.swarm: __init__ failed
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/salt/loader.py", line 1624, in _load_module
module_init(self.opts)
File "/usr/lib/python3.6/site-packages/salt/modules/swarm.py", line 53, in __init__
__context__['client'] = docker.from_env()
AttributeError: module 'docker' has no attribute 'from_env'**
[DEBUG ] key: victorops.api_key, ret: _|-
[DEBUG ] key: victorops:api_key, ret: _|-
[DEBUG ] DSC: Only available on Windows systems
[DEBUG ] Module PSGet: Only available on Windows systems
[DEBUG ] LazyLoaded platform.is_windows
[DEBUG ] Could not LazyLoad pkg.resolve_capabilities: 'pkg.resolve_capabilities' is not available.
[INFO ] All specified packages are already installed
[INFO ] Completed state [gcc-c++] at time 18:09:12.790455 (duration_in_ms=5980.372)
[INFO ] Running state [make] at time 18:09:12.790690
[INFO ] Executing state pkg.installed for [make]
[DEBUG ] Could not LazyLoad pkg.resolve_capabilities: 'pkg.resolve_capabilities' is not available.
[INFO ] All specified packages are already installed
[INFO ] Completed state [make] at time 18:09:12.814836 (duration_in_ms=24.144)
[DEBUG ] File /var/cache/salt/minion/accumulator/140376956609144 does not exist, no need to cleanup
[DEBUG ] LazyLoaded state.check_result
[DEBUG ] LazyLoaded highstate.output
[DEBUG ] LazyLoaded nested.output
So I dug around a while. I was able to replicate using the method described. I put in a little debugging to see what I can find.
It looks like it is importing docker from
/usr/lib/python3.6/site-packages/salt/utils/docker/__init__.py
Not sure how PYTHONPATH is getting twisted enough to load that module as if it was the docker SDK.
looks like im also able to replicate this.
like you said its the docker/__init__.py
file that is being imported as docker, but i do not see /root/salt/salt/utils
in the path, but it was added to the path previously in the loader when we are loading up the __utils__
.
>>> sys.path
['/usr/local/bin', '/salt', '/usr/lib64/python36.zip', '/usr/lib64/python3.6', '/usr/lib64/python3.6/lib-dynload',
'/usr/local/lib64/python3.6/site-packages', '/usr/local/lib/python3.6/site-packages', '/root/salt',
'/usr/lib64/python3.6/site-packages', '/usr/lib/python3.6/site-packages', '/root/salt/salt/modules']
>>> docker.__file__
'/root/salt/salt/utils/docker/__init__.py'
still looking into how to solve this.
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.
This is not stale
Thank you for updating this issue. It is no longer marked as stale.
Still happening.
I'm getting the same debug chatter, much of which is entirely unrelated to what's being installed/used by pkg.install
on ubuntu bionic
.
References appear for the following, even though they have nothing to do with the installation of target package(s):
Which are all reflected in the debug output of this issue, too? I'm not sure which are meant to be expected within default salt-call
runs associated with pkg.*
[DEBUG ] key: ifttt.secret_key, ret: _|-
[DEBUG ] key: ifttt:secret_key, ret: _|-
[DEBUG ] key: pushbullet.api_key, ret: _|-
[DEBUG ] key: pushbullet:api_key, ret: _|-
[DEBUG ] LazyLoaded systemd.booted
[DEBUG ] Error loading module.swarm: init failed
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/salt/loader.py", line 1624, in _load_module
module_init(self.opts)
File "/usr/lib/python3.6/site-packages/salt/modules/swarm.py", line 53, in init
context['client'] = docker.from_env()
AttributeError: module 'docker' has no attribute 'from_env'
[DEBUG ] key: victorops.api_key, ret: _|-
[DEBUG ] key: victorops:api_key, ret: _|-
[DEBUG ] DSC: Only available on Windows systems
[DEBUG ] Module PSGet: Only available on Windows systems
Though, I also get boto3 (AWS) related errors in debug output, too:
[DEBUG ] Could not LazyLoad boto3.assign_funcs: 'boto3.assign_funcs' is not available.
[DEBUG ] Error loading module.boto3_elasticsearch: __init__ failed
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 1664, in _load_module
module_init(self.opts)
File "/usr/lib/python2.7/dist-packages/salt/modules/boto3_elasticsearch.py", line 92, in __init__
__utils__['boto3.assign_funcs'](__name__, 'es')
File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 1248, in __getitem__
func = super(LazyLoader, self).__getitem__(item)
File "/usr/lib/python2.7/dist-packages/salt/utils/lazy.py", line 108, in __getitem__
raise KeyError(key)
KeyError: u'boto3.assign_funcs'
vagrant@ubuntu-bionic:~$ salt-call --versions-report
Salt Version:
Salt: 3000.2
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.6.1
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 2.10
libgit2: Not Installed
M2Crypto: Not Installed
Mako: 1.0.7
msgpack-pure: Not Installed
msgpack-python: 0.5.6
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 2.7.17 (default, Apr 15 2020, 17:20:14)
python-gnupg: 0.4.1
PyYAML: 3.12
PyZMQ: 16.0.2
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.2.5
System Versions:
dist: Ubuntu 18.04 bionic
locale: UTF-8
machine: x86_64
release: 4.15.0-99-generic
system: Linux
version: Ubuntu 18.04 bionic
Using Vagrant and Virtualbox:
vagrant box add ubuntu/bionic64 --provider virtualbox
NOTE: This uses a salt bootstrap which seems to default to using a Python 2.7.17 version of Salt 3000.2 at the moment
vagrant up
vagrant ssh
sudo salt-call --local state.apply -l debug
vagrant@ubuntu-bionic:/srv/salt$ cat top.sls
base:
'*':
- git
vagrant@ubuntu-bionic:/srv/salt$ cat git.sls
git:
pkg:
- installed
These additional debug problems do only occur in:
sudo salt-call --local state.apply -l debug
I've only tested locally against a masterless salt minion.
When attempting to install via sudo salt-call --local pkg.install git
, none of these problems happen. It seems to be tied specifically to salt states.
This is still present in 3001. It makes parsing the debug logs a bit more work.
ZD-5767
Since this is larger than the initial title suggests and as we use docker more and more I am moving it up in severity. Also, in an attempt to get it looked at by anyone willing to open a PR against this.
Description of Issue
I'm getting exception in the debug logs during lazyloading of swarm module. swarm or docker is not used in my setup/configs/states. This is not a blocker for me but it might be hitting some edge case and help in cleaning logs as well.
Setup
I've tested it on freshly provision google compute VM ( n1-standard-1 (1 vCPU, 3.75 GB memory) ) OS: CentOS Linux release 7.7.1908 (Core) Kernel: 3.10.0-1062.1.2.el7.x86_64
Minion config:
States:
Steps to Reproduce Issue
Using the above configs/states run: salt-call state.highstate --local -l debug
Versions Report