8000 Crash in args[module] · Issue #4568 · ansible/ansible-lint · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Crash in args[module] #4568

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

Open
vdl-dsi-architecture opened this issue Apr 1, 2025 · 0 comments
Open

Crash in args[module] #4568

vdl-dsi-architecture opened this issue Apr 1, 2025 · 0 comments
Labels

Comments

@vdl-dsi-architecture
Copy link
vdl-dsi-architecture commented Apr 1, 2025
Summary

Crash when using task alias

Issue Type
  • Bug Report
OS / ENVIRONMENT
ansible-lint --version
ansible-lint 25.1.3 using ansible-core:2.16.14 ansible-compat:25.1.4 ruamel-yaml:0.18.10 ruamel-yaml-clib:0.2.12
  • ansible installation method: pipenv
  • ansible-lint installation method: pipenv
STEPS TO REPRODUCE
- name: Test
  hosts: localhost

  vars:
    database_port: 5432

  tasks:
    - name: Create database user
      community.postgresql.postgresql_user:
        name: "{{ user_name }}"
        password: "{{ user_password }}"
        login_db: "{{ database_name }}"
        login_host: "{{ database_host }}"
        login_port: "{{ database_port }}"
        login_user: "{{ database_login_user }}"
        login_password: "{{ database_login_password }}"
        configuration: "{{ {'role': database_name + '_' + user_type} if ((user_type | default(omit)) != omit) else omit }}"
      delegate_to: localhost
      become: false
DEBUG    Running rule args
WARNING  Ignored exception from ArgsRule.matchtasks while processing ~/projects/_test.yml (playbook): 'port'
DEBUG    Ignored exception details
Traceback (most recent call last):
  File "/home/demarteaub/.local/share/virtualenvs/ansible-JeMCc-2q/lib/python3.12/site-packages/ansiblelint/_internal/rules.py", line 105, in getmatches
    matches.extend(method(file))
                   ^^^^^^^^^^^^
  File "/home/demarteaub/.local/share/virtualenvs/ansible-JeMCc-2q/lib/python3.12/site-packages/ansiblelint/rules/__init__.py", line 178, in matchtasks
    result = self.matchtask(task, file=file)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/demarteaub/.local/share/virtualenvs/ansible-JeMCc-2q/lib/python3.12/site-packages/ansiblelint/rules/args.py", line 197, in matchtask
    self._parse_failed_msg(failed_msg, task, module_name, file),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/demarteaub/.local/share/virtualenvs/ansible-JeMCc-2q/lib/python3.12/site-packages/ansiblelint/rules/args.py", line 243, in _parse_failed_msg
    option_value = task["action"][option_key]
                   ~~~~~~~~~~~~~~^^^^^^^^^^^^
KeyError: 'port'[/]
Desired Behavior

No exception, using an alias is valid. It works fine when using port: instead of login_port:.

Actual Behavior

Please give some details of what is happening. Include a minimum complete
verifiable example
with:

  • minimized playbook to reproduce the error
  • the output of running ansible-lint including the command line used
  • if you're getting a stack trace, also the output of
    ansible-playbook --syntax-check playbook
ansible-playbook --syntax-check ../../_test.yml                     

playbook: ../../_test.yml
@vdl-dsi-architecture vdl-dsi-architecture added bug new Triage required labels Apr 1, 2025
@audgirka audgirka removed the new Triage required label Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

No branches or pull requests

2 participants
0