ansible / ansible-container

DEPRECATED -- Ansible Container was a tool to build Docker images and orchestrate containers using only Ansible playbooks.
GNU Lesser General Public License v3.0
2.19k stars 392 forks source link

docker 3.0.0 and up return a generator from export #916

Closed dhozac closed 5 years ago

dhozac commented 6 years ago

Use the new stream importer to feed it right back.

ISSUE TYPE
SUMMARY

docker>=3.1.4 is getting pulled in by the unbounded dependency on docker-compose. Docker 3.0.0 and up return a generator from container.export(), resulting in a traceback

Traceback (most recent call last):
  File "/usr/bin/conductor", line 11, in <module>
    load_entry_point('ansible-container==0.9.2', 'console_scripts', 'conductor')()
  File "/usr/lib/python2.7/site-packages/container/__init__.py", line 19, in __wrapped__
    return fn(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/container/cli.py", line 399, in conductor_commandline
    **params)
  File "/usr/lib/python2.7/site-packages/container/__init__.py", line 19, in __wrapped__
    return fn(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/container/core.py", line 820, in conductorcmd_build
    image_id = engine.flatten_container(container_id, service_name, service)
  File "/usr/lib/python2.7/site-packages/container/docker/engine.py", line 105, in __wrapped__
    return fn(self, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/container/__init__.py", line 19, in __wrapped__
    return fn(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/container/docker/engine.py", line 637, in flatten_container
    raw_image.read(),
AttributeError: 'generator' object has no attribute 'read'
webknjaz commented 6 years ago

I'd just do docker<3, because there's more API issues to fix. Like:

$ ansible-container build
Building Docker Engine context...
Starting Docker build of Ansible Container Conductor image (please be patient)...
ERROR   Unknown exception
Traceback (most recent call last):
  File "/home/wk/.pyenv/versions/3.6.4/lib/python3.6/site-packages/container/cli.py", line 299, in __call__
    getattr(core, u'hostcmd_{}'.format(args.subcommand))(**vars(args))
  File "/home/wk/.pyenv/versions/3.6.4/lib/python3.6/site-packages/container/__init__.py", line 28, in __wrapped__
    return fn(*args, **kwargs)
  File "/home/wk/.pyenv/versions/3.6.4/lib/python3.6/site-packages/container/core.py", line 181, in hostcmd_build
    environment=env_vars
  File "/home/wk/.pyenv/versions/3.6.4/lib/python3.6/site-packages/container/docker/engine.py", line 105, in __wrapped__
    return fn(self, *args, **kwargs)
  File "/home/wk/.pyenv/versions/3.6.4/lib/python3.6/site-packages/container/__init__.py", line 28, in __wrapped__
    return fn(*args, **kwargs)
  File "/home/wk/.pyenv/versions/3.6.4/lib/python3.6/site-packages/container/docker/engine.py", line 1070, in build_conductor_image
    return image.id
AttributeError: 'tuple' object has no attribute 'id'
Voronenko commented 5 years ago

Thank you for the input. Was re-introduced as a part of https://github.com/ansible/ansible-container/pull/977