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

updating ansible-lint 24.2.2 to 24.6.0 - No module named 'ansible.plugin_utils' no other changes except the update #4208

Closed
shaneholloman opened this issue Jun 5, 2024 · 2 comments · Fixed by #4216
Labels

Comments

@shaneholloman
Copy link

Summary

updating ansible-lint 24.2.2 to 24.6.0 now warns me this:

Ignored exception from ArgsRule.matchtasks while processing roles/base/tasks/windows.yml (tasks): No module named 'ansible.plugin_utils'

Issue Type
  • Bug Report
OS / ENVIRONMENT
ansible-lint --version
  shadmin @ devops ❯ ansible ❯ feat/ansible-lint-production ansible-lint --version
ansible-lint 24.6.0 using ansible-core:2.16.6 ansible-compat:24.6.0 ruamel-yaml:0.18.6 ruamel-yaml-clib:0.2.8
  shadmin @ devops ❯ ansible ❯ feat/ansible-lint-production 
  • ansible installation method: via pip
  • ansible-lint installation method: via via
STEPS TO REPRODUCE
  shadmin @ devops ❯ ansible ❯ feat/ansible-lint-production ansible-lint
WARNING  Ignored exception from ArgsRule.matchtasks while processing roles/base/tasks/windows.yml (tasks): No module named 'ansible.plugin_utils'
n/a
@ssbarnea
Copy link
Member

ssbarnea commented Jun 5, 2024

Please provide some code to reproduce it. AFAIK, these can happen with incorrectly installed collections or bugs from their own code.

You need to be aware that there is no import from "plugin_utils" inside linter, that is likely a module from a collection that is not compatible with version of ansible intalled.

@Qalthos Qalthos removed the new Triage required label Jun 5, 2024
@nurfed1
Copy link

nurfed1 commented Jun 13, 2024

I'm not sure if this is a bug in ansible-lint or elsewhere but I'm seeing similar errors.
These errors aren't shown in version 24.2.2.

Here's the output of a verbose run:

WARNING  Ignored exception from ArgsRule.matchtasks while processing roles/setup/tasks/windows.yml (tasks): No module named 'ansible.plugin_utils'
DEBUG    Ignored exception details
Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/ansiblelint/_internal/rules.py", line 94, in getmatches
    matches.extend(method(file))
                   ^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/ansiblelint/rules/__init__.py", line 178, in matchtasks
    result = self.matchtask(task, file=file)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/ansiblelint/rules/args.py", line 161, in matchtask
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/usr/lib/python3.12/site-packages/ansible_collections/ansible/windows/plugins/action/win_updates.py", line 31, in <module>
    from ..plugin_utils._reboot import reboot_host
ModuleNotFoundError: No module named 'ansible.plugin_utils'


WARNING  Ignored exception from ArgsRule.matchtasks while processing roles/setup/tasks/main.yml (tasks): No module named 'microsoft'
DEBUG    Ignored exception details
Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/ansiblelint/_internal/rules.py", line 94, in getmatches
    matches.extend(method(file))
                   ^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/ansiblelint/rules/__init__.py", line 178, in matchtasks
    result = self.matchtask(task, file=file)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/ansiblelint/rules/args.py", line 161, in matchtask
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/usr/lib/python3.12/site-packages/ansible_collections/microsoft/ad/plugins/action/membership.py", line 4, in <module>
    from ..plugin_utils._module_with_reboot import ActionModuleWithReboot
ModuleNotFoundError: No module named 'microsoft'


WARNING  Ignored exception from ArgsRule.matchtasks while processing roles/setup/tasks/main.yml (tasks): No module named 'microsoft'
DEBUG    Ignored exception details
Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/ansiblelint/_internal/rules.py", line 94, in getmatches
    matches.extend(method(file))
                   ^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/ansiblelint/rules/__init__.py", line 178, in matchtasks
    result = self.matchtask(task, file=file)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/ansiblelint/rules/args.py", line 161, in matchtask
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/usr/lib/python3.12/site-packages/ansible_collections/microsoft/ad/plugins/action/domain_controller.py", line 6, in <module>
    from ..plugin_utils._module_with_reboot import ActionModuleWithReboot
ModuleNotFoundError: No module named 'microsoft'

You can reproduce it will a small playbook like this:

- name: Base setup
  hosts: all
  tasks:
    - name: Install all updates and reboot as many times as needed
      ansible.windows.win_updates:
        category_names: '*'
        reboot: true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants