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

junipernetworks.junos.junos_command should consider the task successful if launched command succeed to execute even though the output includes error keyword. #481

Open
mahoutukaisali opened this issue Dec 24, 2023 · 1 comment
Assignees
Labels
needs_info This issue requires further information. Please answer any outstanding questions.

Comments

@mahoutukaisali
Copy link

SUMMARY

junipernetworks.junos.junos_command module regards the task status as "failed" when request support information command output includes specific keywords like syntax error.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

junipernetworks.junos.junos_command

ANSIBLE VERSION
ansible-core 2.15.2
COLLECTION VERSION
junipernetworks.junos: 5.1.0
STEPS TO REPRODUCE
  • Run the below playbook towards the managed node Junos. As you can see in the execution logs below, the show services advanced-anti-malware command is launched by the request support information command in Junos, but it fails due to a syntax error. While this is likely a bug in Junos, the request support information command itself succeeds, so I believe the Ansible task should be considered successful.
- name: Testing copy software
  hosts: "{{ target }}"

  tasks:
    - name: run show version on remote devices
      junipernetworks.junos.junos_command:
        commands: "request support information"
TASK [run show version on remote devices] **************************************
task path: /path/to/juniper_rsi_junos_command.yml:10
The full traceback is:
  File "/usr/share/ansible/collections/ansible_collections/junipernetworks/junos/plugins/modules/junos_command.py", line 404, in main
    output.append(conn.get(command=cmd))
  File "/usr/local/lib/python3.9/site-packages/ansible/module_utils/connection.py", line 200, in __rpc__
    raise ConnectionError(to_text(msg, errors='surrogate_then_replace'), code=code)
[WARNING]: arguments wait_for, match, rpcs are not supported when using
transport=cli
fatal: [EXAMPLE.HOST.COM]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "commands": [
                "request support information
            ],
            "display": null,
            "interval": 1,
            "match": "all",
            "retries": 10,
            "rpcs": null,
            "wait_for": null
        }
    },
    "msg":

(...)

show services advanced-anti-malware statistics\r\n\r\n\r\nerror: syntax error, expecting <command>: advanced-anti-malware\r\n\r\n{master}\r\nUSER@EXAMPLE.HOST.COM> "

PLAY RECAP *********************************************************************
USER@EXAMPLE.HOST.COM : ok=0    changed=0    unreachable=0   failed=1   skipped=0    rescued=0    ignored=0   
Please review the log for errors.
EXPECTED RESULTS
  • The task should be considered successful since the execution of the request support information command itself is successful.
ACTUAL RESULTS
  • Tha task status will be regarded as failed.
@rohitthakur2590 rohitthakur2590 self-assigned this Mar 8, 2024
@rohitthakur2590
Copy link
Collaborator

@mahoutukaisali , We could not reproduce this , is it possible for you to share the CLI command output?

request support information

@rohitthakur2590 rohitthakur2590 added the needs_info This issue requires further information. Please answer any outstanding questions. label Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs_info This issue requires further information. Please answer any outstanding questions.
Projects
None yet
Development

No branches or pull requests

2 participants