junipernetworks.junos icon indicating copy to clipboard operation
junipernetworks.junos copied to clipboard

junos_command "show configuration system ntp" fails to display json scheme

Open alurmtr opened this issue 2 years ago • 2 comments

SUMMARY
junos_command  "show configuration system ntp" fails to display json scheme
ISSUE TYPE
  • Bug Report
COMPONENT NAME

junipernetworks.junos.junos_command

ANSIBLE VERSION
ansible --version
ansible 2.10.6
python version = 3.6.8 
COLLECTION VERSION
ansible-galaxy collection list junipernetworks.junos

# lib64/python3.6/site-packages/ansible_collections
Collection            Version
--------------------- -------
junipernetworks.junos 1.3.0  

# lib/python3.6/site-packages/ansible_collections
Collection            Version
--------------------- -------
junipernetworks.junos 1.3.0  

OS / ENVIRONMENT
Linux redhat 7
STEPS TO REPRODUCE

  tasks:

  - name: run show version on remote devices
    junipernetworks.junos.junos_command:
      commands:
        - show configuration system ntp
      display: json
    register: ntp_json
EXPECTED RESULTS

expect json output of "show configuration system ntp"

ACTUAL RESULTS

Tracebacks

The full traceback is:
Traceback (most recent call last):
  File "<...>/AnsiballZ_junos_command.py", line 102, in <module>
    _ansiballz_main()
  File "<...>/AnsiballZ_junos_command.py", line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "<...>/AnsiballZ_junos_command.py", line 40, in invoke_module
    runpy.run_module(mod_name='ansible_collections.junipernetworks.junos.plugins.modules.junos_command', init_globals=None, run_name='__main__', alter_sys=True)
  File "/usr/lib64/python3.6/runpy.py", line 205, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib64/python3.6/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_junipernetworks.junos.junos_command_payload_8ge9vdqn/ansible_junipernetworks.junos.junos_command_payload.zip/ansible_collections/junipernetworks/junos/plugins/modules/junos_command.py", line 489, in <module>
  File "/tmp/ansible_junipernetworks.junos.junos_command_payload_8ge9vdqn/ansible_junipernetworks.junos.junos_command_payload.zip/ansible_collections/junipernetworks/junos/plugins/modules/junos_command.py", line 434, in main
  File "/tmp/ansible_junipernetworks.junos.junos_command_payload_8ge9vdqn/ansible_junipernetworks.junos.junos_command_payload.zip/ansible_collections/junipernetworks/junos/plugins/modules/junos_command.py", line 267, in rpc
AttributeError: 'NoneType' object has no attribute 'strip'
fatal: [<device-name>]: FAILED! => {
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n  
File \"<...>/AnsiballZ_junos_command.py\", 
line 102, in <module>\n    _ansiballz_main()\n  
File \"<...>/AnsiballZ_junos_command.py\", 
line 94, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  
File \"<...>/AnsiballZ_junos_command.py\", 
line 40, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.junipernetworks.junos.plugins.modules.junos_command', init_globals=None, run_name='__main__', alter_sys=True)\n  
File \"/usr/lib64/python3.6/runpy.py\", 
line 205, in run_module\n    
return _run_module_code(code, init_globals, run_name, mod_spec)\n  
File \"/usr/lib64/python3.6/runpy.py\", 
line 96, in _run_module_code\n    mod_name, mod_spec, pkg_name, script_name)\n  
File \"/usr/lib64/python3.6/runpy.py\", 
line 85, in _run_code\n    exec(code, run_globals)\n  
File \"/tmp/ansible_junipernetworks.junos.junos_command_payload_8ge9vdqn/ansible_junipernetworks.junos.junos_command_payload.zip/ansible_collections/junipernetworks/junos/plugins/modules/junos_command.py\", 
line 489, in <module>\n  
File \"/tmp/ansible_junipernetworks.junos.junos_command_payload_8ge9vdqn/ansible_junipernetworks.junos.junos_command_payload.zip/ansible_collections/junipernetworks/junos/plugins/modules/junos_command.py\", 
line 434, in main\n  
File \"/tmp/ansible_junipernetworks.junos.junos_command_payload_8ge9vdqn/ansible_junipernetworks.junos.junos_command_payload.zip/ansible_collections/junipernetworks/junos/plugins/modules/junos_command.py\", 
line 267, in rpc\nAttributeError: 'NoneType' object has no attribute 'strip'\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

alurmtr avatar Apr 15 '22 22:04 alurmtr

This seems to be an issue starting at the "show configuration system" level.

Also "set" is not supported. Getting the error

"Display format 'set' is not supported by remote device."

alurmtr avatar Apr 20 '22 11:04 alurmtr

@alurmtr Thank you for contributing to ansible! This seems to be an issue, We will analyse this at our end and will get back to you with proper fix, In case you have more NTP focused operations, I would recommend to try the new junos_ntp_global resource module (https://docs.ansible.com/ansible/latest/collections/junipernetworks/junos/junos_ntp_global_module.html )

rohitthakur2590 avatar Apr 21 '22 07:04 rohitthakur2590