Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker_image: 'NoneType' object is not iterable #94

Closed
asarubbo opened this issue Feb 26, 2021 · 9 comments
Closed

docker_image: 'NoneType' object is not iterable #94

asarubbo opened this issue Feb 26, 2021 · 9 comments
Labels
docker-plain plain Docker (no swarm, no compose, no stack)

Comments

@asarubbo
Copy link

SUMMARY

After the update from 2.10.4 to 2.10.5 we got 'NoneType' object is not iterable from docker_image module with an historical playbook that didn't got changes since years.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

docker_image

ANSIBLE VERSION
ansible 2.10.5
  config file = /home/ago/.ansible.cfg
  configured module search path = ['/home/ago/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.8/site-packages/ansible
  executable location = /usr/lib/python-exec/python3.8/ansible
  python version = 3.8.7 (default, Feb 22 2021, 20:07:18) [GCC 9.3.0]
CONFIGURATION
ANSIBLE_PIPELINING(/home/ago/.ansible.cfg) = True
ANSIBLE_SSH_ARGS(/home/ago/.ansible.cfg) = -o ControlMaster=auto -o ControlPersist=20m -o PreferredAuthentications=publickey
DEFAULT_FORKS(/home/ago/.ansible.cfg) = 30
DEFAULT_HOST_LIST(/home/ago/.ansible.cfg) = ['/home/ago/git/ansible/common/hosts']
DEFAULT_REMOTE_USER(/home/ago/.ansible.cfg) = root
DEFAULT_STDOUT_CALLBACK(env: ANSIBLE_STDOUT_CALLBACK) = actionable
DEPRECATION_WARNINGS(/home/ago/.ansible.cfg) = False
HOST_KEY_CHECKING(/home/ago/.ansible.cfg) = False
INTERPRETER_PYTHON(/home/ago/.ansible.cfg) = auto_legacy_silent
OS / ENVIRONMENT

Gentoo x86_64

STEPS TO REPRODUCE
    - name: Docker load image
      docker_image:
        name: "{{ docker_registry }}:5000/qm{{ docker_build_version }}"
        tag: "{{ docker_build_tag }}"
        source: load
        push: yes
        load_path: "{{ install_directory }}/qm{{ docker_build_version }}_{{ docker_build_tag }}.tar.xz"
EXPECTED RESULTS

Do not get errors

ACTUAL RESULTS
    "msg": "Error loading image dr.queuemetrics-live.com:5000/qm20.11.18 - 'NoneType' object is not iterable",
    "stdout": "",
    "stdout_lines": []

In any case, the strangeness is that the image is load as per what "docker images" reports.

@felixfontein
Copy link
Collaborator

If you upgrade to Ansible 2.10.6, you will find that this has been fixed (#73, ansible-collections/community.general#1678).

Alternatively, you can upgrade your ancient version of Docker SDK for Python to a newer one, that will also fix the issue :)

@asarubbo
Copy link
Author

thanks for the hint, it worked!

However I received the following expected message:

[WARNING]: The installed version of the Docker SDK for Python does not return the loading results from the Docker daemon. Therefore, we cannot verify whether the expected
image was loaded, whether multiple images where loaded, or whether the load actually succeeded. If you are not stuck with Python 2.6, *please* upgrade to a version newer
than 2.5.0 (2.5.0 was released in August 2017).

then I decided to move to the python36-docker.noarch package (I'm trying on CentOS) and I noticed that the task does not report it as Changed when it does its job..do I need to report it somewhere?

@felixfontein
Copy link
Collaborator

@asarubbo it should only report changed=True if the image wasn't already there.

@asarubbo
Copy link
Author

It' doesn't here..

@felixfontein
Copy link
Collaborator

Are you sure that the image (not the image's tag!) wasn't there before? This behavior is covered by a test in CI, so I'm pretty sure it works.

@asarubbo
Copy link
Author

It was there before, but before run the playbook I'm removing the image with docker image rm $IMAGE

@felixfontein
Copy link
Collaborator

If the image has multiple tags, docker image rm $IMAGE only removes the tag, but not the image. You need to run docker image rm -f $IMAGE_ID to be sure that all tags and the image itself are removed.

@felixfontein felixfontein added the docker-plain plain Docker (no swarm, no compose, no stack) label Feb 28, 2021
@felixfontein
Copy link
Collaborator

@asarubbo is this issue resolved from your point of view?

@asarubbo
Copy link
Author

asarubbo commented Mar 5, 2021

yes, thank you =)

@asarubbo asarubbo closed this as completed Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker-plain plain Docker (no swarm, no compose, no stack)
Projects
None yet
Development

No branches or pull requests

2 participants