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] pillar wanted breaking state when compose not included #297

Closed tyhunt99 closed 3 years ago

tyhunt99 commented 3 years ago

Your setup

Formula commit hash / release tag

Tag: v2.0.7

Versions reports (master & minion)

master version ``` Salt Version: Salt: 3003.2 Dependency Versions: cffi: Not Installed cherrypy: Not Installed dateutil: 2.6.1 docker-py: Not Installed gitdb: 2.0.3 gitpython: 2.1.8 Jinja2: 2.10 libgit2: 0.26.0 M2Crypto: Not Installed Mako: Not Installed msgpack: 0.5.6 msgpack-pure: Not Installed mysql-python: Not Installed pycparser: Not Installed pycrypto: 2.6.1 pycryptodome: 3.4.7 pygit2: 0.26.2 Python: 3.6.9 (default, Jan 26 2021, 15:33:00) python-gnupg: 0.4.1 PyYAML: 3.12 PyZMQ: 17.1.2 smmap: 2.0.3 timelib: Not Installed Tornado: 4.5.3 ZMQ: 4.2.5 System Versions: dist: ubuntu 18.04 Bionic Beaver locale: UTF-8 machine: x86_64 release: 5.4.0-1055-aws system: Linux version: Ubuntu 18.04 Bionic Beaver ```
minion version ``` Salt Version: Salt: 3000.9 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, Feb 27 2021, 15:10:58) 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: 5.4.0-1055-aws system: Linux version: Ubuntu 18.04 bionic ```

Pillar / config used

Pillar data ``` docker: wanted: - docker pkg: docker: version: 20.10.8 use_upstream: package daemon_config: log-driver: json-file log-opts: max-size: 20m max-file: '10' ```

Bug details

Describe the bug

I am trying to use the wanted so that I only get the core docker installed. I do not want docker-compose, since there is a dependency in that package on a library that breaks docker login. I configure the pillar to only install docker. It fails to render when I change the defaults in the pillar data.

salt minion1 state.apply docker
minion1:
    Data failed to compile:
----------
    Rendering SLS 'base:docker.compose.software.binary.install' failed: Jinja variable 'dict object' has no attribute 'path'

Steps to reproduce the bug

  1. Enable this repo through gitfs
  2. Set the following pillar data on the target minion:
    docker:
    wanted:
    - docker
  3. Try to apply the state with: state.apply docker

Expected behaviour

I would expect the core docker components to be installed and it would skip the docker compose install state. And I would be able to run containers and commands as expected eg docker ps -a.

Attempts to fix the bug

I have tried to also set supported to docker only and no luck, same error:

docker:
  wanted:
    - docker
  supported:
    - docker

Additional context

The defaults work, so if I do not set the wanted or supported values then it works but installs docker-compose as expected.

noelmcloughlin commented 3 years ago

Thanks for report @tyhunt99
Can you try running docker.software instead of docker to see what happens? I raised a PR #298 which may fix this issue.

tyhunt99 commented 3 years ago

Running just docker.software directly it works as expected

noelmcloughlin commented 3 years ago

298