saltstack-formulas / docker-formula

Install and set up Docker
http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
136 stars 330 forks source link

[BUG] docker_* states not available with onedir salt install #327

Open satwell opened 1 year ago

satwell commented 1 year ago

Your setup

Formula commit hash / release tag

v2.4.2

Versions reports (master & minion)

# salt-call -V
Salt Version:
          Salt: 3006.0

Python Version:
        Python: 3.10.11 (main, Apr 14 2023, 05:57:16) [GCC 11.2.0]

Dependency Versions:
          cffi: 1.14.6
      cherrypy: 18.6.1
      dateutil: 2.8.1
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.2
       libgit2: Not Installed
  looseversion: 1.0.2
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 22.0
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.9.8
        pygit2: Not Installed
  python-gnupg: 0.4.8
        PyYAML: 5.4.1
         PyZMQ: 23.2.0
        relenv: 0.11.2
         smmap: Not Installed
       timelib: 0.2.4
       Tornado: 4.5.3
           ZMQ: 4.3.4

System Versions:
          dist: debian 11 bullseye
        locale: utf-8
       machine: x86_64
       release: 5.10.0-21-cloud-amd64
        system: Linux
       version: Debian GNU/Linux 11 bullseye

Pillar / config used


Bug details

Describe the bug

salt 3006.0 and newer support only onedir installs. These versions install their own Python interpreter, separate from the system packages.

The docker_* states such as docker_container rely on the docker Python package. docker-formula installs this as a system package on most OSes (except centos/redhat), which means that it's not available to salt onedir installs. So docker states that require the Python module fail with an error like 'docker_image' __virtual__ returned False: 'docker.version' is not available.

Steps to reproduce the bug

Install salt 3006.0 on Debian and try to use docker-formula to install docker and create containers. This will fail with an error that says 'docker.version' is not available.

Expected behaviour

docker_* states should work after installing docker with docker-formula.

Attempts to fix the bug

As a workaround, I'm installing the docker Python package in a separate state with pip.installed, which installs into Salt's own Python interpreter:

docker-pip-package:
  pip.installed:
    - name: docker
    - reload_modules: true
    - require_in:
      - pkg: docker-software-package-install-pkg

Additional context