Skip to content

fix for UnboundLocalError#824

Merged
chidanandpujar merged 1 commit into
Juniper:masterfrom
chidanandpujar:rpctimeout
May 18, 2026
Merged

fix for UnboundLocalError#824
chidanandpujar merged 1 commit into
Juniper:masterfrom
chidanandpujar:rpctimeout

Conversation

@chidanandpujar

@chidanandpujar chidanandpujar commented May 7, 2026

Copy link
Copy Markdown
Collaborator

Fix for issue #822 #823

@chidanandpujar

Copy link
Copy Markdown
Collaborator Author

Test logs:

(issue823venv) regress@masterhost:~/ansible_issue_823/ansible-junos-stdlib/tests$ cat pb.juniper_junos_issue_823.yml 
---
- name: Test juniper.device.rpc module
  hosts: all
  gather_facts: false

  tasks:
#################
    - name: "Execute single RPC get-software-information without any kwargs"
      juniper.device.rpc:
        rpcs:
          - "get-checksum-information"
        format: xml
        kwargs:
          - path: "/var/tmp/junos-x86-64-25.4R1.12.tgz"
        timeout: 10
      register: test1
      tags: [test1]

    - name: Check TEST 1
      ansible.builtin.debug:
        var: test1

(issue823venv) regress@masterhost:~/ansible_issue_823/ansible-junos-stdlib/tests$ ansible-playbook -i inventory pb.juniper_junos_issue_823.yml 

PLAY [Test juniper.device.rpc module] ************************************************************************************************

TASK [Execute single RPC get-software-information without any kwargs] ****************************************************************
[WARNING]: Deprecation warnings can be disabled by setting `deprecation_warnings=False` in ansible.cfg.
[DEPRECATION WARNING]: Importing 'to_bytes' from 'ansible.module_utils._text' is deprecated. This feature will be removed from ansible-core version 2.24. Use ansible.module_utils.common.text.converters instead.
[DEPRECATION WARNING]: The safe_eval function should not be used. This feature will be removed from ansible-core version 2.21.
[ERROR]: Task failed: Module failed: Unable to execute the RPC: b'<get-checksum-information format="xml">\n  <path>/var/tmp/junos-x86-64-25.4R1.12.tgz</path>\n</get-checksum-information>\n'. Error: command timeout triggered, timeout value is 10 secs.
See the timeout setting options in the Network Debug and Troubleshooting Guide.
Origin: /home/regress/ansible_issue_823/ansible-junos-stdlib/tests/pb.juniper_junos_issue_823.yml:8:7

6   tasks:
7 #################
8     - name: "Execute single RPC get-software-information without any kwargs"
        ^ column 7

fatal: [pyez_connection_testcases]: FAILED! => {"attrs": null, "changed": false, "format": "xml", "kwargs": {"path": "/var/tmp/junos-x86-64-25.4R1.12.tgz"}, "msg": "Unable to execute the RPC: b'<get-checksum-information format=\"xml\">\\n  <path>/var/tmp/junos-x86-64-25.4R1.12.tgz</path>\\n</get-checksum-information>\\n'. Error: command timeout triggered, timeout value is 10 secs.\nSee the timeout setting options in the Network Debug and Troubleshooting Guide.", "rpc": "get-checksum-information"}

PLAY RECAP ***************************************************************************************************************************
pyez_connection_testcases  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   



(issue823venv) regress@masterhost:~/ansible_issue_823/ansible-junos-stdlib/tests$ ansible-playbook -i inventory pb.juniper_junos_issue_823.yml 

PLAY [Test juniper.device.rpc module] ************************************************************************************************

TASK [Execute single RPC get-software-information without any kwargs] ****************************************************************
[WARNING]: Deprecation warnings can be disabled by setting `deprecation_warnings=False` in ansible.cfg.
[DEPRECATION WARNING]: Importing 'to_bytes' from 'ansible.module_utils._text' is deprecated. This feature will be removed from ansible-core version 2.24. Use ansible.module_utils.common.text.converters instead.
[DEPRECATION WARNING]: The safe_eval function should not be used. This feature will be removed from ansible-core version 2.21.
[ERROR]: Task failed: Module failed: Unable to execute the RPC: b'<get-checksum-information xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" format="xml">\n  <path>/var/tmp/junos-x86-64-25.4R1.12.tgz</path>\n</get-checksum-information>\n'. Error: RpcTimeoutError(host: xx.xx.xx.xx, cmd: get-checksum-information, timeout: 10)
Origin: /home/regress/ansible_issue_823/ansible-junos-stdlib/tests/pb.juniper_junos_issue_823.yml:8:7

6   tasks:
7 #################
8     - name: "Execute single RPC get-software-information without any kwargs"
        ^ column 7

fatal: [local_connection_testcases]: FAILED! => {"attrs": null, "changed": false, "format": "xml", "kwargs": {"path": "/var/tmp/junos-x86-64-25.4R1.12.tgz"}, "msg": "Unable to execute the RPC: b'<get-checksum-information xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\" format=\"xml\">\\n  <path>/var/tmp/junos-x86-64-25.4R1.12.tgz</path>\\n</get-checksum-information>\\n'. Error: RpcTimeoutError(host: xx.xx.xx.xx, cmd: get-checksum-information, timeout: 10)", "rpc": "get-checksum-information"}

PLAY RECAP ***************************************************************************************************************************
local_connection_testcases : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   



@chidanandpujar chidanandpujar merged commit 717a988 into Juniper:master May 18, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants