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

Raise error in case of empty hosts list in playbook #56354

Merged
merged 1 commit into from May 21, 2019

Conversation

Projects
None yet
4 participants
@cinek810
Copy link
Contributor

commented May 13, 2019

SUMMARY

Currently in case of playbook contaiing:

- hosts:
  -

ansible-playbook will fail with:

ERROR! Unexpected Exception, this is probably a bug: sequence item 0: expected string, NoneType found
the full traceback was:

Traceback (most recent call last):
  File "/usr/bin/ansible-playbook", line 118, in <module>
    exit_code = cli.run()
  File "/usr/lib/python2.7/dist-packages/ansible/cli/playbook.py", line 122, in run
    results = pbex.run()
  File "/usr/lib/python2.7/dist-packages/ansible/executor/playbook_executor.py", line 81, in run
    pb = Playbook.load(playbook_path, variable_manager=self._variable_manager, loader=self._loader)
  File "/usr/lib/python2.7/dist-packages/ansible/playbook/__init__.py", line 54, in load
    pb._load_playbook_data(file_name=file_name, variable_manager=variable_manager)
  File "/usr/lib/python2.7/dist-packages/ansible/playbook/__init__.py", line 106, in _load_playbook_data
    entry_obj = Play.load(entry, variable_manager=variable_manager, loader=self._loader)
  File "/usr/lib/python2.7/dist-packages/ansible/playbook/play.py", line 110, in load
    data['name'] = ','.join(data['hosts'])
TypeError: sequence item 0: expected string, NoneType found
ISSUE TYPE
  • Bugfix Pull Request
Show resolved Hide resolved lib/ansible/playbook/play.py

@ansibot ansibot added needs_revision and removed core_review labels May 13, 2019

@cinek810 cinek810 force-pushed the cinek810:raiseErrorForEmptyHostsList branch from 707af06 to 14d8dfb May 13, 2019

Raise error in case of empty hosts list in playbook
Currently in case of playbook contaiing:
- hosts:
  -
ansible-playbook will fail with:
ERROR! Unexpected Exception, this is probably a bug: sequence item 0: expected string, NoneType found
the full traceback was:

Traceback (most recent call last):
  File "/usr/bin/ansible-playbook", line 118, in <module>
    exit_code = cli.run()
  File "/usr/lib/python2.7/dist-packages/ansible/cli/playbook.py", line 122, in run
    results = pbex.run()
  File "/usr/lib/python2.7/dist-packages/ansible/executor/playbook_executor.py", line 81, in run
    pb = Playbook.load(playbook_path, variable_manager=self._variable_manager, loader=self._loader)
  File "/usr/lib/python2.7/dist-packages/ansible/playbook/__init__.py", line 54, in load
    pb._load_playbook_data(file_name=file_name, variable_manager=variable_manager)
  File "/usr/lib/python2.7/dist-packages/ansible/playbook/__init__.py", line 106, in _load_playbook_data
    entry_obj = Play.load(entry, variable_manager=variable_manager, loader=self._loader)
  File "/usr/lib/python2.7/dist-packages/ansible/playbook/play.py", line 110, in load
    data['name'] = ','.join(data['hosts'])
TypeError: sequence item 0: expected string, NoneType found

@cinek810 cinek810 force-pushed the cinek810:raiseErrorForEmptyHostsList branch from 7cfa37f to b8d1094 May 14, 2019

@samdoran samdoran added P3 and removed needs_triage labels May 21, 2019

@bcoca

bcoca approved these changes May 21, 2019

@bcoca bcoca merged commit afc678e into ansible:devel May 21, 2019

1 check passed

Shippable Run 122745 status is SUCCESS.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.