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

TypeError: 'NoneType' object is not iterable #11693

Closed
basictheprogram opened this issue Jul 22, 2015 · 1 comment
Closed

TypeError: 'NoneType' object is not iterable #11693

basictheprogram opened this issue Jul 22, 2015 · 1 comment
Labels
bug This issue/PR relates to a bug. P2 Priority 2 - Issue Blocks Release
Milestone

Comments

@basictheprogram
Copy link

Issue Type:

Bug Report

Ansible Version:

$ ansible --version
ansible 2.0.0 (devel ae54792) last updated 2015/07/21 22:43:44 (GMT -500)
lib/ansible/modules/core: (detached HEAD 55bc9e8) last updated 2015/07/21 15:39:28 (GMT -500)
lib/ansible/modules/extras: (detached HEAD 26c1bd7) last updated 2015/07/21 15:39:28 (GMT -500)
v1/ansible/modules/core: (detached HEAD f8d8af1) last updated 2015/06/03 00:37:54 (GMT -500)
v1/ansible/modules/extras: (detached HEAD 495ad45) last updated 2015/06/03 00:37:58 (GMT -500)
configured module search path = None

Ansible Configuration:

$ source hacking/env-setup

Environment:

OS X Yosemite 10.10.4

$ python -V
Python 2.7.6

$ pip freeze
ansible==2.0.0
coverage==3.7.1
coveralls==0.5
docopt==0.6.2
ecdsa==0.13
epdb==0.12
httplib2==0.9.1
isodate==0.5.1
Jinja2==2.7.3
kerberos==1.2.2
linecache2==1.0.0
MarkupSafe==0.23
mock==1.0.1
nose==1.3.7
paramiko==1.15.2
passlib==1.6.2
pycallgraph==1.0.1
pycrypto==2.6.1
pywinrm==0.0.3
PyYAML==3.11
requests==2.7.0
six==1.9.0
traceback2==1.4.0
unittest2==1.0.1
xmltodict==0.9.2

Summary:

When a host is unreachable ansible-playbook eventually throws an [ERROR]: Unexpected Exception: 'NoneType' object is not iterable

Steps To Reproduce:

Using the same setup and configuration I used in #11320

$ source hacking/env-setup
$ cd ../playbooks/
$ ansible-playbook -k -K --tags=apt -i issue11320-inventory  issue11320.yml
SSH password:
SUDO password[defaults to SSH password]:
PLAY ****************************************************************************
TASK [setup] ********************************************************************
<snip>
fatal: [www.bright-futures.org]: FAILED! => {
    "failed": true,
    "msg": "ERROR! [Errno 51] Network is unreachable"
}
<snip>
 [ERROR]: Unexpected Exception: 'NoneType' object is not iterable

With debug enabled and --fork=1

$ ansible-playbook -k -K --tags=apt -i issue11320-inventory  issue11320.yml --fork=1 -vvv
Using /Volumes/Warrior1TB/Users/tanner/projects/ansible.git/playbooks/ansible.cfg as config file
SSH password:
SUDO password[defaults to SSH password]:
1 plays in issue11320.yml
PLAY ****************************************************************************
TASK [setup] ********************************************************************
<snip>
fatal: [www.bright-futures.org]: FAILED! => {
    "failed": true,
    "msg": "ERROR! [Errno 51] Network is unreachable"
}
<snip>
 [ERROR]: Unexpected Exception: 'NoneType' object is not iterable

the full traceback was:

Traceback (most recent call last):
  File "/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/bin/ansible-playbook", line 77, in <module>
    sys.exit(cli.run())
  File "/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/cli/playbook.py", line 148, in run
    results = pbex.run()
  File "/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/executor/playbook_executor.py", line 161, in run
    result = self._tqm.run(play=play)
  File "/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/executor/task_queue_manager.py", line 194, in run
    return strategy.run(iterator, play_context)
  File "/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/strategies/linear.py", line 141, in run
    host_tasks = self._get_next_task_lockstep(hosts_left, iterator)
  File "/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/strategies/linear.py", line 103, in _get_next_task_lockstep
    return _advance_selected_hosts(hosts, lowest_cur_block, PlayIterator.ITERATING_TASKS)
  File "/Volumes/Warrior1TB/Users/tanner/projects/ansible.git/ansible/lib/ansible/plugins/strategies/linear.py", line 85, in _advance_selected_hosts
    (s, t) = host_tasks[host.name]
TypeError: 'NoneType' object is not iterable

Remove the unreachable host from the inventory file.

$ ansible-playbook -k -K --tags=apt -i issue11320-inventory  issue11320.yml
SSH password:
SUDO password[defaults to SSH password]:
PLAY ****************************************************************************
TASK [setup] ********************************************************************
<snip>
TASK [issue11320 : issue11320 : include] ***************************************
<snip>
TASK [issue11320 : issue11320 : package update (apt)] **************************
<snip>
TASK [issue11320 : issue11320 : package upgrade (apt)] *************************
<snip>
TASK [issue11320 : issue11320 : ansible_os_family from debian.yml apt] *********
<snip>
PLAY RECAP *********************************************************************
<snip>
Expected Results:

I assume the plays would run to completion even if multiple hosts are unreachable.

@bcoca bcoca added bug_report P2 Priority 2 - Issue Blocks Release labels Jul 22, 2015
@bcoca bcoca added this to the v2 milestone Jul 22, 2015
@jimi-c jimi-c closed this as completed in dfcf6a2 Jul 22, 2015
@jimi-c
Copy link
Member

jimi-c commented Jul 22, 2015

Closing This Ticket

Hi!

We believe the above commit should resolve this problem for you. This will also be included in the next major release.

If you continue seeing any problems related to this issue, or if you have any further questions, please let us know by stopping by one of the two mailing lists, as appropriate:

Because this project is very active, we're unlikely to see comments made on closed tickets, but the mailing list is a great way to ask questions, or post if you don't think this particular issue is resolved.

Thank you!

@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 6, 2018
@ansible ansible locked and limited conversation to collaborators Apr 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue/PR relates to a bug. P2 Priority 2 - Issue Blocks Release
Projects
None yet
Development

No branches or pull requests

4 participants