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

same_variables_defined_in_competing_groups fails with Ansible 2.4 #38

Open
patrickmacarthur opened this issue Oct 21, 2017 · 1 comment
Labels

Comments

@patrickmacarthur
Copy link

When this rule runs on an inventory file, it fails with the following traceback:

Traceback (most recent call last):                                                    
  File "/home/pmacarth/.local/bin/ansible-review", line 11, in <module>
    load_entry_point('ansible-review==0.13.4', 'console_scripts', 'ansible-review')()
  File "/home/pmacarth/.local/lib/python2.7/site-packages/ansiblereview/__main__.py", line 95, in main
    errors = errors + candidate.review(options, lines)
  File "/home/pmacarth/.local/lib/python2.7/site-packages/ansiblereview/__init__.py", line 76, in review
    return utils.review(self, settings, lines)
  File "/home/pmacarth/.local/lib/python2.7/site-packages/ansiblereview/utils/__init__.py", line 120, in review
    result = standard.check(candidate, settings)
  File "/home/pmacarth/.local/lib/python2.7/site-packages/ansiblereview/groupvars.py", line 56, in same_variable_defined_in_competing_groups
    var_manager = ansible.vars.VariableManager()
AttributeError: 'module' object has no attribute 'VariableManager'

Fixing this to import from ansible.vars.manager only makes it fail with another traceback:

Traceback (most recent call last):
  File "/home/pmacarth/.local/bin/ansible-review", line 11, in <module>
    load_entry_point('ansible-review==0.13.4', 'console_scripts', 'ansible-review')()
  File "/home/pmacarth/.local/lib/python2.7/site-packages/ansiblereview/__main__.py", line 95, in main
    errors = errors + candidate.review(options, lines)
  File "/home/pmacarth/.local/lib/python2.7/site-packages/ansiblereview/__init__.py", line 76, in review
    return utils.review(self, settings, lines)
  File "/home/pmacarth/.local/lib/python2.7/site-packages/ansiblereview/utils/__init__.py", line 120, in review
    result = standard.check(candidate, settings)
  File "/home/pmacarth/.local/lib/python2.7/site-packages/ansiblereview/groupvars.py", line 61, in same_variable_defined_in_competing_groups
    inv = _inv or ansible.inventory.Inventory(loader=loader,
AttributeError: 'module' object has no attribute 'Inventory'

This would appear to be due to the overhaul in ansible/ansible#23001, so the corresponding code here should be adjusted to allow it to work with Ansible 2.4.

@willthames
Copy link
Owner

You are indeed quite right, but 'should be adjusted' understates things somewhat as it's really 'should be rewritten almost entirely from scratch'. I have the same problem with ansible-inventory-grapher, I know I need to fix them both, but I haven't yet found the time to do so. Soon I hope though.

@willthames willthames added the bug label Oct 22, 2017
apatard added a commit to apatard/ansible-review that referenced this issue Nov 13, 2018
Convert inventory to use the newly introduced parse_inventory
function.
This should fix willthames#38.

Signed-off-by: Arnaud Patard <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants