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

ansible-lint warns when about FQCN when linting collection with dependencies #2924

Closed
AKorezin opened this issue Jan 20, 2023 · 0 comments · Fixed by #3446
Closed

ansible-lint warns when about FQCN when linting collection with dependencies #2924

AKorezin opened this issue Jan 20, 2023 · 0 comments · Fixed by #3446
Assignees
Labels

Comments

@AKorezin
Copy link

AKorezin commented Jan 20, 2023

Summary

When I lint my collection with dependencies, ansible-lint prints warnings about FQCN related to dependencies.

WARNING  Unable to load module ansible.posix.sysctl at roles/test/tasks/main.yml:2 for options validation
WARNING  Unable to resolve FQCN for module ansible.posix.sysctl
Issue Type
  • Bug Report
OS / ENVIRONMENT
ansible-lint 6.11.0 using ansible 2.14.1
  • ansible installation method: pip
  • ansible-lint installation method: pip
STEPS TO REPRODUCE
  1. Install ansible-lint==6.11.0 and ansible-core=2.14.0.
  2. Install git.
  3. Create a new collection.
  4. Add dependencies to galaxy.yml.
    dependencies:
      ansible.posix: "*"
  5. Create a role in roles dir.
  6. Create a task with ansible.posix.sysctl.
  7. Run ansible-lint.
Desired Behavior

Properly find installed dependencies.

Actual Behavior

You can check the repository with an example https://gitlab.com/AKorezin/ansible-lint-issue-2924.
I use gitlab-ci to lint the collection. You can check the script here.
Job logs

# ansible-lint -vvvvvv
DEBUG    Logging initialized to level 10
DEBUG    Options: Namespace(cache_dir='/root/.cache/ansible-compat/a1d14f', colored=False, configured=True, cwd=PosixPath('/builds/AKorezin/ansible-lint-issue-0'), display_relative_path=True, exclude_paths=['.cache', '.git', '.hg', '.svn', '.tox'], format='rich', lintables=[], list_rules=False, list_tags=False, write_list=[], parseable=False, quiet=False, rulesdirs=['/usr/local/lib/python3.10/site-packages/ansiblelint/rules'], skip_list=['galaxy[no-changelog]'], tags=[], verbosity=6, warn_list=['avoid-implicit', 'experimental', 'fqcn[action]', 'fqcn[redirect]', 'jinja[spacing]', 'name[casing]', 'name[play]', 'name[prefix]', 'role-name', 'warning[empty-playbook]', 'role-name[path]'], 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}'}, {'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}'}], mock_filters=[], mock_modules=[], mock_roles=[], loop_var_prefix=None, only_builtins_allow_collections=[], only_builtins_allow_modules=[], var_naming_pattern=None, offline=False, project_dir='.', extra_vars=None, enable_list=[], skip_action_validation=True, strict=False, rules={}, profile=None, task_name_prefix='{stem} | ', list_profiles=False, progressive=False, rulesdir=[], use_default_rules=False, config_file='/builds/AKorezin/ansible-lint-issue-0/.ansible-lint', version=False, cache_dir_lock=<filelock._unix.UnixFileLock object at 0x7fcd3379cf40>)
DEBUG    /builds/AKorezin/ansible-lint-issue-0
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': False, '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/a1d14f/modules:/root/.ansible/plugins/modules:/usr/share/ansible/plugins/modules
INFO     Set ANSIBLE_COLLECTIONS_PATH=/root/.cache/ansible-compat/a1d14f/collections:/root/.ansible/collections:/usr/share/ansible/collections
INFO     Set ANSIBLE_ROLES_PATH=/root/.cache/ansible-compat/a1d14f/roles:roles:/root/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles
INFO     Running from /builds/AKorezin/ansible-lint-issue-0 : ansible-galaxy collection install -vvv --force -p /root/.cache/ansible-compat/a1d14f/collections .
INFO     Discovered files to lint using: git -c safe.directory=/builds/AKorezin/ansible-lint-issue-0 ls-files --cached --others --exclude-standard -z
INFO     Excluded removed files using: git -c safe.directory=/builds/AKorezin/ansible-lint-issue-0 ls-files --deleted -z
DEBUG    Added role: roles/test (role)
INFO     Discovered files to lint using: git -c safe.directory=/builds/AKorezin/ansible-lint-issue-0 ls-files --cached --others --exclude-standard -z
INFO     Excluded removed files using: git -c safe.directory=/builds/AKorezin/ansible-lint-issue-0 ls-files --deleted -z
DEBUG    Excluded .gitlab-ci.yml (yaml)
DEBUG    Examining roles/test of type role
DEBUG    Examining .ansible-lint of type ansible-lint-config
DEBUG    Examining roles/test/tasks/main.yml of type tasks
WARNING  Unable to load module ansible.posix.sysctl at roles/test/tasks/main.yml:2 for options validation
WARNING  Unable to resolve FQCN for module ansible.posix.sysctl
DEBUG    Examining galaxy.yml of type galaxy
DEBUG    Examining roles/test/meta/main.yml of type meta
DEBUG    Attempting to release lock 140519308644160 on /root/.cache/ansible-compat/a1d14f/.lock
DEBUG    Lock 140519308644160 released on /root/.cache/ansible-compat/a1d14f/.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-command-syntax': (7, 'basic'), 'deprecated-local-action': (8, 'basic'), 'deprecated-module': (9, 'basic'), 'inline-env-var': (10, 'basic'), 'key-order': (11, 'basic'), 'literal-compare': (12, 'basic'), 'jinja': (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'), 'no-free-form': (26, 'moderate'), 'spell-var-name': (27, 'moderate'), 'avoid-implicit': (28, 'safety'), 'latest': (29, 'safety'), 'package-latest': (30, 'safety'), 'risky-file-permissions': (31, 'safety'), 'risky-octal': (32, 'safety'), 'risky-shell-pipe': (33, 'safety'), 'galaxy': (34, 'shared'), 'ignore-errors': (35, 'shared'), 'layout': (36, 'shared'), 'meta-incorrect': (37, 'shared'), 'meta-no-info': (38, 'shared'), 'meta-no-tags': (39, 'shared'), 'meta-video-links': (40, 'shared'), 'meta-version': (41, 'shared'), 'meta-unsupported-ansible': (42, 'shared'), 'no-changed-when': (43, 'shared'), 'no-changelog': (44, 'shared'), 'no-handler': (45, 'shared'), 'no-relative-paths': (46, 'shared'), 'max-block-depth': (47, 'shared'), 'max-tasks': (48, 'shared'), 'unsafe-loop': (49, 'shared'), 'avoid-dot-notation': (50, 'production'), 'disallowed-ignore': (51, 'production'), 'fqcn': (52, 'production'), 'import-task-no-when': (53, 'production'), 'meta-no-dependencies': (54, 'production'), 'single-entry-point': (55, 'production'), 'use-loop': (56, 'production')}
Passed with production profile: 0 failure(s), 0 warning(s) on 5 files.
Additional

Maybe a duplicate of #2741.

@AKorezin AKorezin added bug new Triage required labels Jan 20, 2023
@AKorezin AKorezin changed the title Ansible-lint prints warning when linting collection ansible-lint warns when about FQCN when linting collection with dependencies Jan 20, 2023
@ssbarnea ssbarnea removed the new Triage required label Mar 15, 2023
@ssbarnea ssbarnea self-assigned this Mar 15, 2023
ssbarnea added a commit to ansible/ansible-compat that referenced this issue May 15, 2023
ssbarnea added a commit to ansible/ansible-compat that referenced this issue May 15, 2023
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.

2 participants