salt: Problem with new version of docker-py which has inpact on docker_image.present state

Description of Issue/Question

After new release of docker-py (https://github.com/docker/docker-py/releases/tag/2.7.0), salt is not able to install docker-py and download docker image during one iteration despite that reload_modules is set to True.

----------
          ID: fetch-mysql_image-image
    Function: docker_image.present
        Name: mysql
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1837, in call
                  **cdata['kwargs'])
                File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 1794, in wrapper
                  return f(*args, **kwargs)
                File "/usr/lib/python2.7/dist-packages/salt/states/docker_image.py", line 174, in present
                  all_tags = __salt__['docker.list_tags']()
                File "/usr/lib/python2.7/dist-packages/salt/modules/dockermod.py", line 1439, in list_tags
                  for item in six.itervalues(images()):
                File "/usr/lib/python2.7/dist-packages/salt/modules/dockermod.py", line 1228, in images
                  response = _client_wrapper('images', all=kwargs.get('all', False))
                File "/usr/lib/python2.7/dist-packages/salt/modules/dockermod.py", line 404, in wrapper
                  ret = wrapped(*args, **kwargs)
                File "/usr/lib/python2.7/dist-packages/salt/modules/dockermod.py", line 637, in _client_wrapper
                  raise CommandExecutionError(msg)
              CommandExecutionError: Unable to perform images: cannot import name universaldetector
     Started: 14:03:08.798976
    Duration: 3.59 ms
     Changes:   

second iteration:

----------
          ID: fetch-mysql_image-image
    Function: docker_image.present
        Name: mysql
      Result: True
     Comment: Image 'mysql' was pulled
     Started: 14:03:51.264695
    Duration: 45582.392 ms
     Changes:   
              ----------
              Layers:
                  ----------
                  Pulled:
                      - 78032de49d65
                      - 837546b20bc4
                      - 9b8316af6cc6
                      - 86f3913b029a
                      - 4cbbfc9aebab
                      - 1056cf29b9f1
                      - 45d90f823f97
                      - ca2a791aeb35
                      - f49cf87b52c1
                      - 8ffd0352f6a8
              Status:
                  Downloaded newer image for mysql:latest
              Time_Elapsed:
                  45.5688691139

On older version of docker-py (2.6.1)

install-docker-python-package:
  pip.installed:
    - name: docker < 2.7
    - reload_modules: true
    - require:
      - pkg: python-pip
Salt Version:
           Salt: 2017.7.1
 
Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.4.2
      docker-py: 2.6.1
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.8
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: 1.0.3
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.12 (default, Nov 20 2017, 18:23:56)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.2.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4

Salt is downloading images during first try

Setup

State which can reproduce issue

install-docker:
  pkg.installed:
    - name: docker-engine
    - version: 1.12.6*

enable-docker-service:
  service.running:
    - name: docker
    - enable: True

install-python-pip:
  pkg.installed:
    - name: python-pip
  pip.installed:
    - name: pip
    - upgrade: True

install-docker-python-package:
  pip.installed:
    - name: docker
    - reload_modules: true
    - require:
      - pkg: python-pip

fetch-mysql_image-image:
  docker_image.present:
    - name: mysql
    - require:
      - install-docker-python-package

Steps to Reproduce Issue

Add repo for docker and run state

Versions Report

Salt Version:
           Salt: 2017.7.1
 
Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.4.2
      docker-py: 2.7.0
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.8
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: 1.0.3
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.12 (default, Nov 20 2017, 18:23:56)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.2.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4
 
System Versions:
           dist: Ubuntu 16.04 xenial
         locale: ANSI_X3.4-1968
        machine: x86_64
        release: 4.4.0-104-generic
         system: Linux
        version: Ubuntu 16.04 xenial

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 33 (23 by maintainers)

Most upvoted comments

@hemebond the two log lines show that modules are being reloaded.

@dawidmalina I know for a fact that module reloading works, because we have exhaustive integration tests that make sure it does.

Unless I can get a reproducible test case, there’s not much I can do. I tried to reproduce pretty extensively and was not able to.

I’m not denying that the problem exists, but I don’t have enough information on the edge case we’re hitting here to be able to move forward.