ansible / ansible-modules-core

Ansible modules - these modules ship with ansible
1.3k stars 1.95k forks source link

'list' object has no attribute 'items'\r\n" #5906

Closed apotek closed 7 years ago

apotek commented 7 years ago

From @xiemeilong on August 4, 2016 5:47

ISSUE TYPE
ansible 2.1.1.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides
CONFIGURATION
OS / ENVIRONMENT
SUMMARY
STEPS TO REPRODUCE

---
- hosts: all
  remote_user: root
  tasks:
  - name: pull run business web
    docker:
      name: business-web
      image: "xxxxxx:10150/yuanmai/business-web:{{version}}"
      insecure_registry: yes
      state: reloaded
      pull: always
      restart_policy: always
      restart_policy_retry: 3
      extra_hosts:
        consul-8500.service.consul: "{{consul}}"
      volumes:
      - /opt/web/file:/opt/web/file
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro
      ports:
      - "8085:8080"
  - name: pull run billing web
    docker:
      name: billing-web
      image: "xxxxxxx:10150/yuanmai/billing-web:{{version}}"
      insecure_registry: yes
      state: reloaded
      restart_policy: always
      restart_policy_retry: 3
      extra_hosts:
        consul-8500.service.consul: "{{consul}}"
      volumes:
      - /opt/web/file:/opt/web/file
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro
      pull: always
      ports:
      - "8084:8080"
  - name: pull run billing pay service
    docker:
      name: billing-pay
      image: "xxxx:10150/yuanmai/billing-pay:{{version}}"
      insecure_registry: yes
      state: reloaded
      restart_policy: always
      restart_policy_retry: 3
      extra_hosts:
        consul-8500.service.consul: "{{consul}}"
      volumes:
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro
      pull: always
      ports:
      - "8086:9090"
ansible-playbook deploy.yml  --extra-vars "version=Release-1.0.17"  -vvv  -f 4 -i production
EXPECTED RESULTS
PLAY [all] *********************************************************************

TASK [setup] *******************************************************************
ok: [test02]

TASK [pull run business web] ***************************************************
changed: [test02]

TASK [pull run billing web] ****************************************************
changed: [test02]

TASK [pull run billing pay service] ********************************************
changed: [test02]

PLAY RECAP *********************************************************************
test02                     : ok=4    changed=3    unreachable=0    failed=0   
ACTUAL RESULTS
TASK [setup] *******************************************************************
<58.215.178.243> ESTABLISH SSH CONNECTION FOR USER: root
<58.215.178.243> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o Port=6322 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/xiemeilong/.ansible/cp/ansible-ssh-%h-%p-%r 58.215.178.243 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1470289137.72-245841536783431 `" && echo ansible-tmp-1470289137.72-245841536783431="` echo $HOME/.ansible/tmp/ansible-tmp-1470289137.72-245841536783431 `" ) && sleep 0'"'"''
<58.215.178.243> PUT /tmp/tmpUExJBz TO /root/.ansible/tmp/ansible-tmp-1470289137.72-245841536783431/setup
<58.215.178.243> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o Port=6322 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/xiemeilong/.ansible/cp/ansible-ssh-%h-%p-%r '[58.215.178.243]'
<58.215.178.243> ESTABLISH SSH CONNECTION FOR USER: root
<58.215.178.243> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o Port=6322 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/xiemeilong/.ansible/cp/ansible-ssh-%h-%p-%r -tt 58.215.178.243 '/bin/sh -c '"'"'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1470289137.72-245841536783431/setup; rm -rf "/root/.ansible/tmp/ansible-tmp-1470289137.72-245841536783431/" > /dev/null 2>&1 && sleep 0'"'"''
ok: [web01]

TASK [pull run business web] ***************************************************
task path: /home/xiemeilong/Projects/LogisticsBilling/bin/ansible/deploy.yml:5
<58.215.178.243> ESTABLISH SSH CONNECTION FOR USER: root
<58.215.178.243> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o Port=6322 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/xiemeilong/.ansible/cp/ansible-ssh-%h-%p-%r 58.215.178.243 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1470289138.64-252795182131668 `" && echo ansible-tmp-1470289138.64-252795182131668="` echo $HOME/.ansible/tmp/ansible-tmp-1470289138.64-252795182131668 `" ) && sleep 0'"'"''
<58.215.178.243> PUT /tmp/tmpFu07WR TO /root/.ansible/tmp/ansible-tmp-1470289138.64-252795182131668/docker
<58.215.178.243> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o Port=6322 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/xiemeilong/.ansible/cp/ansible-ssh-%h-%p-%r '[58.215.178.243]'
<58.215.178.243> ESTABLISH SSH CONNECTION FOR USER: root
<58.215.178.243> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o Port=6322 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/xiemeilong/.ansible/cp/ansible-ssh-%h-%p-%r -tt 58.215.178.243 '/bin/sh -c '"'"'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1470289138.64-252795182131668/docker; rm -rf "/root/.ansible/tmp/ansible-tmp-1470289138.64-252795182131668/" > /dev/null 2>&1 && sleep 0'"'"''
fatal: [web01]: FAILED! =>
 {"changed": false, "failed": true, "invocation": {"module_name": "docker"}, "module_stderr": "", "module_stdout": 
"Traceback (most recent call last):
File \"/tmp/ansible_8msQQL/ansible_module_docker.py\", line 1975, in <module>
    main()\r\n  File \"/tmp/ansible_8msQQL/ansible_module_docker.py\", line 1945, in main    reloaded(manager, containers, count, name)
  File \"/tmp/ansible_8msQQL/ansible_module_docker.py\", line 1799, in reloaded
    started(manager, containers, count, name)
  File \"/tmp/ansible_8msQQL/ansible_module_docker.py\", line 1776, in started
    created = manager.create_containers(delta)
  File \"/tmp/ansible_8msQQL/ansible_module_docker.py\", line 1641, in create_containers
    params['host_config'] = self.create_host_config()
  File \"/tmp/ansible_8msQQL/ansible_module_docker.py\", line 1018, in create_host_config
    return docker.utils.create_host_config(**params)
  File \"/usr/local/lib/python2.7/dist-packages/docker/utils/utils.py\", line 403, in create_host_config
    host_config['Binds'] = convert_volume_binds(binds)
  File \"/usr/local/lib/python2.7/dist-packages/docker/utils/utils.py\", line 173, in convert_volume_binds
    for k, v in binds.items():
AttributeError: 'list' object has no attribute 'items'
", "msg": "MODULE FAILURE", "parsed": false}

NO MORE HOSTS LEFT *************************************************************
 [WARNING]: Could not create retry file 'deploy.retry'.         [Errno 2] No such file or directory: ''

PLAY RECAP *********************************************************************
web01                      : ok=1    changed=0    unreachable=0    failed=1   

Copied from original issue: ansible/ansible#16944

apotek commented 7 years ago

From @alikins on August 8, 2016 14:30

Looking at the stack trace, this appears to be a bug in the 'docker' module in ansible-module-core.

We would appreciate if you can submit this there (https://github.com/ansible/ansible-modules-core) instead. (If we move it, the owner of the issue resets to ansible instead of you).

ansibot commented 7 years ago

This repository has been locked. All new issues and pull requests should be filed in https://github.com/ansible/ansible

Please read through the repomerge page in the dev guide.

apotek commented 7 years ago

Appears this might be a duplicate of https://github.com/ansible/ansible-modules-core/issues/4363 in any case, although it was not referenced in the original issue.