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

host pattern that is an integer produces traceback #31978

Closed
itdependsnetworks opened this issue Oct 20, 2017 · 4 comments · Fixed by #31993
Closed

host pattern that is an integer produces traceback #31978

itdependsnetworks opened this issue Oct 20, 2017 · 4 comments · Fixed by #31993
Labels
affects_2.3 This issue/PR affects Ansible v2.3 bug This issue/PR relates to a bug. support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@itdependsnetworks
Copy link
Contributor

ISSUE TYPE
  • Bug Report
COMPONENT NAME

Inventory

ANSIBLE VERSION

2.3 -> devel


CONFIGURATION
OS / ENVIRONMENT
SUMMARY

This came up on slack a bit ago, I suspect an issue was not logged. It looks to me as inventory is interpreting the group as an integer, then failing when it is not iterable.

The issue seems to comes from

elif ',' in pattern:

STEPS TO REPRODUCE

Create a group in inventory with only integers

[2911]
ios-rt01
ios-rt02
EXPECTED RESULTS
ACTUAL RESULTS
Using /etc/ansible/ansible.cfg as config file
PLAYBOOK: ios_radius_2.yml ************************************************************************************************************************
1 plays in ios_radius_2.yml
ERROR! Unexpected Exception: argument of type 'int' is not iterable
the full traceback was:
Traceback (most recent call last):
  File "/usr/bin/ansible-playbook", line 109, in <module>
    exit_code = cli.run()
  File "/usr/lib/python2.7/dist-packages/ansible/cli/playbook.py", line 154, in run
    results = pbex.run()
  File "/usr/lib/python2.7/dist-packages/ansible/executor/playbook_executor.py", line 125, in run
    all_vars = self._variable_manager.get_vars(loader=self._loader, play=play)
  File "/usr/lib/python2.7/dist-packages/ansible/vars/__init__.py", line 236, in get_vars
    include_delegate_to=include_delegate_to,
  File "/usr/lib/python2.7/dist-packages/ansible/vars/__init__.py", line 429, in _get_magic_variables
    variables['ansible_play_hosts_all'] = [x.name for x in self._inventory.get_hosts(pattern=pattern, ignore_restrictions=True)]
  File "/usr/lib/python2.7/dist-packages/ansible/inventory/__init__.py", line 247, in get_hosts
    patterns = Inventory.split_host_pattern(pattern)
  File "/usr/lib/python2.7/dist-packages/ansible/inventory/__init__.py", line 284, in split_host_pattern
    elif ',' in pattern:
TypeError: argument of type 'int' is not iterable
Add Comment
@ansibot
Copy link
Contributor

ansibot commented Oct 20, 2017

@ansibot ansibot added affects_2.3 This issue/PR affects Ansible v2.3 bug_report needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Oct 20, 2017
@mkrizek mkrizek removed the needs_triage Needs a first human triage before being processed. label Oct 20, 2017
@bcoca
Copy link
Member

bcoca commented Oct 20, 2017

no, pattern does not come from inventory, it comes from host patterns

@bcoca bcoca changed the title Inventory groups of integers fail host pattern that is an integer produces traceback Oct 20, 2017
bcoca added a commit to bcoca/ansible that referenced this issue Oct 20, 2017
@itdependsnetworks
Copy link
Contributor Author

I'm not sure what that means, but it looks like you have fixed

@bcoca
Copy link
Member

bcoca commented Oct 20, 2017

the source of the issue was not the inventory definition, but the selection criteria, for example from play hosts: or similar from --limit , which are 'host patterns'

bcoca added a commit that referenced this issue Oct 20, 2017
abadger pushed a commit that referenced this issue Oct 26, 2017
fixes #31978

(cherry picked from commit ab8bacd)
abadger pushed a commit that referenced this issue Oct 26, 2017
fixes #31978

(cherry picked from commit ab8bacd)
@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 7, 2018
@ansible ansible locked and limited conversation to collaborators Apr 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.3 This issue/PR affects Ansible v2.3 bug This issue/PR relates to a bug. support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants