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 violation: missing required arguments: _inventory_hostname, _module_name, _module_utils_path (warning) #623

Closed
zippanto opened this issue Jun 29, 2023 · 2 comments

Comments

@zippanto
Copy link

Issue Type

  • Bug Report

Module Name

juniper.device collection and Python libraries version

user@machine JunOS % ansible --version
ansible [core 2.14.3]
  config file = /Users/user/JunOS/ansible.cfg
  configured module search path = ['/Users/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/7.3.0/libexec/lib/python3.11/site-packages/ansible
  ansible collection location = /Users/user/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.11.2 (main, Feb 16 2023, 03:07:35) [Clang 14.0.0 (clang-1400.0.29.202)] (/usr/local/Cellar/ansible/7.3.0/libexec/bin/python3.11)
  jinja version = 3.1.2
  libyaml = True
user@machine JunOS % pip freeze
ansible-pylibssh==1.0.0
bcrypt==3.2.2
cffi==1.15.1
cryptography==37.0.4
Jinja2==3.1.2
junos-eznc==2.6.4
jxmlease==1.0.3
lxml==4.9.1
MarkupSafe==2.1.1
ncclient==0.6.13
netaddr==0.8.0
paramiko==2.11.0
pycparser==2.21
PyNaCl==1.5.0
pyparsing==3.0.9
pyserial==3.5
PyYAML==6.0
scp==0.14.4
six==1.16.0
transitions==0.8.11
xmltodict==0.13.0
yamlordereddictloader==0.4.0

Summary

Running ansible-lint against the playbook produces a fatal violation.

Looking at the source code of the module it seems the arguments mentioned in the violation are set to be required although they are hidden. We presume this is what's causing this issue.

Steps to reproduce

Create a playbook file with the contents below. Then run ansible-lint against the playbook file.

---
- name: NTP
  hosts: all
  gather_facts: false
  connection: local

- name: Play
  hosts: all
  tasks:
    - name: Set ntp
      juniper.device.command:
        commands:
          - set date ntp 1.2.3.4

Expected results

No violations to be produced by ansible-lint

Actual results

ansible-lint produces violations

user@machine JunOS % ansible-lint linttest.yml
WARNING  Listing 1 violation(s) that are fatal
args[module]: missing required arguments: _inventory_hostname, _module_name, _module_utils_path (warning)
linttest.yml:10 Task/Handler: Set ntp

Read documentation for instructions on how to ignore specific rule violations.

                  Rule Violation Summary                   
 count tag          profile rule associated tags           
     1 args[module]         syntax, experimental (warning) 

Passed: 0 failure(s), 1 warning(s) on 1 files. Last profile that met the validation criteria was 'production'. Rating: 5/5 star
@salfers
Copy link

salfers commented Mar 13, 2024

With an up-to-date Ansible version (2.16.x) this now seems to be a fatal error during playbook execution:

TASK [Compare active to candidate configuration] ******************************************************************
task path: [...].yml:96
redirecting (type: connection) ansible.builtin.network_cli to ansible.netcommon.network_cli
redirecting (type: terminal) ansible.builtin.junos to junipernetworks.junos.junos
redirecting (type: cliconf) ansible.builtin.junos to junipernetworks.junos.junos
fatal: [test-ex3300]: FAILED! => {"changed": false, "msg": "missing required arguments: _inventory_hostname, _module_name, _module_utils_path"}

Edit: opened a new issue for this -> #644

@dineshbaburam91
Copy link
Collaborator

@salfers fixed #664

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

No branches or pull requests

4 participants