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

ios_command return empty output if persistent socket timeout is triggered #43076

Closed
ganeshrn opened this issue Jul 20, 2018 · 2 comments · Fixed by #43078
Closed

ios_command return empty output if persistent socket timeout is triggered #43076

ganeshrn opened this issue Jul 20, 2018 · 2 comments · Fixed by #43078
Assignees
Labels
affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. cisco Cisco technologies ios Cisco IOS community networking Network category support:core This issue/PR relates to code supported by the Ansible Engineering Team. traceback This issue/PR includes a traceback.

Comments

@ganeshrn
Copy link
Member

SUMMARY

If a command timeout triggers and persistent socket is closed is results in empty output

ISSUE TYPE
  • Bug Report
COMPONENT NAME

bin/ansible-connection

ANSIBLE VERSION
2.7
CONFIGURATION
OS / ENVIRONMENT
STEPS TO REPRODUCE
  tasks:
  - name: fetch running config
    ios_command:
      commands: 
        - show running-config all
    vars:
      ansible_command_timeout: 1
EXPECTED RESULTS
[ios]: FAILED! => {
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n  File \"/var/folders/8l/27cd4l3n2vnc2cpk3498__680000gn/T/ansible_BoEKEj/ansible_module_ios_command.py\", line 247, in <module>\n    main()\n  File \"/var/folders/8l/27cd4l3n2vnc2cpk3498__680000gn/T/ansible_BoEKEj/ansible_module_ios_command.py\", line 217, in main\n    responses = run_commands(module, commands)\n  File \"/var/folders/8l/27cd4l3n2vnc2cpk3498__680000gn/T/ansible_BoEKEj/ansible_modlib.zip/ansible/module_utils/network/ios/ios.py\", line 125, in run_commands\n  File \"/var/folders/8l/27cd4l3n2vnc2cpk3498__680000gn/T/ansible_BoEKEj/ansible_modlib.zip/ansible/module_utils/connection.py\", line 149, in __rpc__\nansible.module_utils.connection.ConnectionError: command timeout triggered, timeout value is 1 secs\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE",
    "rc": 1
}
ACTUAL RESULTS
ok: [ios] => {
    "changed": false,
    "invocation": {
        "module_args": {
            "auth_pass": null,
            "authorize": null,
            "commands": [
                "show running-config all"
            ],
            "host": null,
            "interval": 1,
            "match": "all",
            "password": null,
            "port": null,
            "provider": null,
            "retries": 10,
            "ssh_keyfile": null,
            "timeout": null,
            "username": null,
            "wait_for": null
        }
    },
    "stdout": [
        "None"
    ],
    "stdout_lines": [
        [
            "None"
        ]
    ]
}
@ansibot
Copy link
Contributor

ansibot commented Jul 20, 2018

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot added affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. traceback This issue/PR includes a traceback. labels Jul 20, 2018
@mkrizek mkrizek removed the needs_triage Needs a first human triage before being processed. label Jul 20, 2018
@ganeshrn ganeshrn self-assigned this Jul 20, 2018
@ganeshrn ganeshrn added the networking Network category label Jul 20, 2018
ganeshrn added a commit to ganeshrn/ansible that referenced this issue Jul 24, 2018
Fixes ansible#43076

If persistent connection timeout is triggered, riase
exception which will be send over socket to module code
instead of silently shutting down the socket.
@ansibot
Copy link
Contributor

ansibot commented Jul 28, 2018

ganeshrn added a commit that referenced this issue Aug 2, 2018
* Raise exception if command timeout is triggered

Fixes #43076

If persistent connection timeout is triggered, riase
exception which will be send over socket to module code
instead of silently shutting down the socket.

* Fix CI failure

* Fix review comment

* Fix CI failure

* Fix review comment

* Fix review comment
@dagwieers dagwieers added ios Cisco IOS community cisco Cisco technologies labels Mar 5, 2019
@ansible ansible locked and limited conversation to collaborators Jul 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. cisco Cisco technologies ios Cisco IOS community networking Network category support:core This issue/PR relates to code supported by the Ansible Engineering Team. traceback This issue/PR includes a traceback.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants