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

Since 6.10.0: New args rule broken for most windows modules. (Unable to load module <most windows modules> for options validation) #3200

Closed
gone-for-coding opened this issue Mar 17, 2023 · 2 comments · Fixed by #3305
Assignees
Labels

Comments

@gone-for-coding
Copy link

Summary

When linting playbooks with newer versions of ansible lint this message is printed for windows modules:

Unable to load module <most windows modules> for options validation

The last working version is 6.9.1 - The issue shows up since 6.10.0!

Issue Type
  • Bug Report
OS / ENVIRONMENT
ansible-lint --version
ansible-lint 6.14.2 using ansible 2.14.2
  • ansible installation method: one of source, pip, OS package -> pip
  • ansible-lint installation method: one of source, pip, OS package -> pip
STEPS TO REPRODUCE

Install collection ansible.windows then lint the following playbook:

---
- name: Configure Windows Systems
  hosts: all
  tasks:
    - name: Create software directory
      ansible.windows.win_file:
        path: "c:\\testdir"
        state: directory
ansible-lint playbook.yml
root@60f15304ae34:/tmp/poc# ansible-galaxy collection list

# /usr/share/ansible/collections/ansible_collections
Collection                      Version
------------------------------- -------
ansible.windows                 1.13.0
community.crypto                2.10.0
community.general               6.3.0
community.mysql                 3.6.0
community.vmware                2.10.3
community.windows               1.12.0
Desired Behavior

The linter should not produce a warning.

Actual Behavior
root@60f15304ae34:/tmp/poc# ansible-lint playbook.yml
WARNING  Unable to load module ansible.windows.win_file at playbook.yml:5 for options validation

Passed with production profile: 0 failure(s), 0 warning(s) on 1 files.

root@60f15304ae34:/tmp/poc# ansible-lint -vvv playbook.yml
DEBUG    Logging initialized to level 10
DEBUG    Options: Namespace(cache_dir='/root/.cache/ansible-compat/18889a', colored=True, configured=True, cwd=PosixPath('/tmp/poc'), display_relative_path=True, exclude_paths=['.cache', '.git', '.hg', '.svn', '.tox'], format=None, lintables=['playbook.yml'], list_rules=False, list_tags=False, write_list=None, parseable=False, quiet=0, rulesdirs=['/usr/local/lib/python3.11/site-packages/ansiblelint/rules'], skip_list=[], tags=[], verbosity=3, warn_list=['experimental', 'jinja[spacing]'], kinds=[{'jinja2': '**/*.j2'}, {'jinja2': '**/*.j2.*'}, {'yaml': '.github/**/*.{yaml,yml}'}, {'text': '**/templates/**/*.*'}, {'execution-environment': '**/execution-environment.yml'}, {'ansible-lint-config': '**/.ansible-lint'}, {'ansible-lint-config': '**/.config/ansible-lint.yml'}, {'ansible-navigator-config': '**/ansible-navigator.{yaml,yml}'}, {'inventory': '**/inventory/**.{yaml,yml}'}, {'requirements': '**/meta/requirements.{yaml,yml}'}, {'galaxy': '**/galaxy.yml'}, {'reno': '**/releasenotes/*/*.{yaml,yml}'}, {'tasks': '**/tasks/**/*.{yaml,yml}'}, {'rulebook': '**/rulebooks/*.{yml,yaml'}, {'playbook': '**/playbooks/*.{yml,yaml}'}, {'playbook': '**/*playbook*.{yml,yaml}'}, {'role': '**/roles/*/'}, {'handlers': '**/handlers/*.{yaml,yml}'}, {'vars': '**/{host_vars,group_vars,vars,defaults}/**/*.{yaml,yml}'}, {'test-meta': '**/tests/integration/targets/*/meta/main.{yaml,yml}'}, {'meta': '**/meta/main.{yaml,yml}'}, {'meta-runtime': '**/meta/runtime.{yaml,yml}'}, {'arg_specs': '**/meta/argument_specs.{yaml,yml}'}, {'yaml': '.config/molecule/config.{yaml,yml}'}, {'requirements': '**/molecule/*/{collections,requirements}.{yaml,yml}'}, {'yaml': '**/molecule/*/{base,molecule}.{yaml,yml}'}, {'requirements': '**/requirements.{yaml,yml}'}, {'playbook': '**/molecule/*/*.{yaml,yml}'}, {'yaml': '**/{.ansible-lint,.yamllint}'}, {'changelog': '**/changelogs/changelog.yaml'}, {'yaml': '**/*.{yaml,yml}'}, {'yaml': '**/.*.{yaml,yml}'}, {'sanity-ignore-file': '**/tests/sanity/ignore-*.txt'}], mock_filters=[], mock_modules=[], mock_roles=[], loop_var_prefix=None, only_builtins_allow_collections=[], only_builtins_allow_modules=[], var_naming_pattern=None, offline=None, project_dir='.', extra_vars=None, enable_list=[], skip_action_validation=True, strict=False, rules={}, profile=None, task_name_prefix='{stem} | ', sarif_file=None, list_profiles=False, progressive=False, rulesdir=[], use_default_rules=False, generate_ignore=False, config_file=None, ignore_file=None, version=False, cache_dir_lock=<filelock._unix.UnixFileLock object at 0x7fdd70199650>)
DEBUG    /tmp/poc
DEBUG    Effective yamllint rules used: {'braces': {'level': 'error', 'forbid': False, 'min-spaces-inside': 0, 'max-spaces-inside': 1, 'min-spaces-inside-empty': -1, 'max-spaces-inside-empty': -1}, 'brackets': {'level': 'error', 'forbid': False, 'min-spaces-inside': 0, 'max-spaces-inside': 0, 'min-spaces-inside-empty': -1, 'max-spaces-inside-empty': -1}, 'colons': {'level': 'error', 'max-spaces-before': 0, 'max-spaces-after': 1}, 'commas': {'level': 'error', 'max-spaces-before': 0, 'min-spaces-after': 1, 'max-spaces-after': 1}, 'comments': {'level': 'warning', 'require-starting-space': True, 'ignore-shebangs': True, 'min-spaces-from-content': 1}, 'comments-indentation': False, 'document-end': False, 'document-start': False, 'empty-lines': {'level': 'error', 'max': 2, 'max-start': 0, 'max-end': 0}, 'empty-values': False, 'float-values': False, 'hyphens': {'level': 'error', 'max-spaces-after': 1}, 'indentation': {'level': 'error', 'spaces': 'consistent', 'indent-sequences': True, 'check-multi-line-strings': False}, 'key-duplicates': {'level': 'error'}, 'key-ordering': False, 'line-length': {'level': 'error', 'max': 160, 'allow-non-breakable-words': True, 'allow-non-breakable-inline-mappings': False}, 'new-line-at-end-of-file': {'level': 'error'}, 'new-lines': {'level': 'error', 'type': 'unix'}, 'octal-values': {'forbid-implicit-octal': True, 'forbid-explicit-octal': True, 'level': 'error'}, 'quoted-strings': False, 'trailing-spaces': {'level': 'error'}, 'truthy': {'level': 'warning', 'allowed-values': ['true', 'false'], 'check-keys': True}}
INFO     Set ANSIBLE_LIBRARY=/root/.cache/ansible-compat/18889a/modules:/root/.ansible/plugins/modules:/usr/share/ansible/plugins/modules
INFO     Set ANSIBLE_COLLECTIONS_PATH=/root/.cache/ansible-compat/18889a/collections:/root/.ansible/collections:/usr/share/ansible/collections
INFO     Set ANSIBLE_ROLES_PATH=/root/.cache/ansible-compat/18889a/roles:/root/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles
INFO     Executing syntax check on playbook playbook.yml (0.54s)
DEBUG    Examining playbook.yml of type playbook
WARNING  Unable to load module ansible.windows.win_file at playbook.yml:5 for options validation
DEBUG    Attempting to release lock 140589045225040 on /root/.cache/ansible-compat/18889a/.lock
DEBUG    Lock 140589045225040 released on /root/.cache/ansible-compat/18889a/.lock

DEBUG    Determined rule-profile order: {'internal-error': (0, 'min'), 'load-failure': (1, 'min'), 'parser-error': (2, 'min'), 'syntax-check': (3, 'min'), 'command-instead-of-module': (4, 'basic'), 'command-instead-of-shell': (5, 'basic'), 'deprecated-bare-vars': (6, 'basic'), 'deprecated-local-action': (7, 'basic'), 'deprecated-module': (8, 'basic'), 'inline-env-var': (9, 'basic'), 'key-order': (10, 'basic'), 'literal-compare': (11, 'basic'), 'jinja': (12, 'basic'), 'no-free-form': (13, 'basic'), 'no-jinja-when': (14, 'basic'), 'no-tabs': (15, 'basic'), 'partial-become': (16, 'basic'), 'playbook-extension': (17, 'basic'), 'role-name': (18, 'basic'), 'schema': (19, 'basic'), 'name': (20, 'basic'), 'var-naming': (21, 'basic'), 'yaml': (22, 'basic'), 'name[template]': (23, 'moderate'), 'name[imperative]': (24, 'moderate'), 'name[casing]': (25, 'moderate'), 'spell-var-name': (26, 'moderate'), 'avoid-implicit': (27, 'safety'), 'latest': (28, 'safety'), 'package-latest': (29, 'safety'), 'risky-file-permissions': (30, 'safety'), 'risky-octal': (31, 'safety'), 'risky-shell-pipe': (32, 'safety'), 'galaxy': (33, 'shared'), 'ignore-errors': (34, 'shared'), 'layout': (35, 'shared'), 'meta-incorrect': (36, 'shared'), 'meta-no-info': (37, 'shared'), 'meta-no-tags': (38, 'shared'), 'meta-video-links': (39, 'shared'), 'meta-version': (40, 'shared'), 'meta-runtime': (41, 'shared'), 'no-changed-when': (42, 'shared'), 'no-changelog': (43, 'shared'), 'no-handler': (44, 'shared'), 'no-relative-paths': (45, 'shared'), 'max-block-depth': (46, 'shared'), 'max-tasks': (47, 'shared'), 'unsafe-loop': (48, 'shared'), 'avoid-dot-notation': (49, 'production'), 'sanity': (50, 'production'), 'fqcn': (51, 'production'), 'import-task-no-when': (52, 'production'), 'meta-no-dependencies': (53, 'production'), 'single-entry-point': (54, 'production'), 'use-loop': (55, 'production')}
Passed with production profile: 0 failure(s), 0 warning(s) on 1 files.

Regarding older versions:

root@60f15304ae34:/tmp/poc# ansible-lint playbook.yml

Passed with production profile: 0 failure(s), 0 warning(s) on 1 files.
A new release of ansible-lint is available: 6.9.1 → 6.14.2

root@60f15304ae34:/tmp/poc# ansible-lint playbook.yml
WARNING  Unable to load module ansible.windows.win_file at playbook.yml:5 for options validation

Passed with production profile: 0 failure(s), 0 warning(s) on 1 files.
A new release of ansible-lint is available: 6.10.0 → 6.14.2

See also:
#2828

@gone-for-coding gone-for-coding added bug new Triage required labels Mar 17, 2023
@gone-for-coding
Copy link
Author

If I skip the new args rule, the warning disappears. The issue seems to be around here:
https://github.com/ansible/ansible-lint/blob/main/src/ansiblelint/rules/args.py#L132

@gone-for-coding gone-for-coding changed the title Since 6.10.0: Unable to load module <most windows modules> for options validation Since 6.10.0: New args rule broken for most windows modules. (Unable to load module <most windows modules> for options validation) Mar 20, 2023
@gone-for-coding
Copy link
Author

FYI: @ganeshrn as you have written the new module.

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

Successfully merging a pull request may close this issue.

3 participants