You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get the following error when trying to run a command using juniper.device.command using juniper.device version 1.0.7
The full traceback is:
Traceback (most recent call last):
File "/home/josephn/tmp/.ansible/ansible-tmp-1734733433.9948735-1257834-271372075631705/AnsiballZ_command.py", line 107, in <module>
_ansiballz_main()
File "/home/josephn/tmp/.ansible/ansible-tmp-1734733433.9948735-1257834-271372075631705/AnsiballZ_command.py", line 99, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/home/josephn/tmp/.ansible/ansible-tmp-1734733433.9948735-1257834-271372075631705/AnsiballZ_command.py", line 47, in invoke_module
runpy.run_module(mod_name='ansible_collections.juniper.device.plugins.modules.command', init_globals=dict(_module_fqn='ansible_collections.juniper.device.plugins.modules.command', _modlib_path=modlib_path),
File "/usr/lib/python3.10/runpy.py", line 224, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "/usr/lib/python3.10/runpy.py", line 96, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/tmp/ansible_juniper.device.command_payload_gx_z54jo/ansible_juniper.device.command_payload.zip/ansible_collections/juniper/device/plugins/modules/command.py", line 504, in <module>
File "/tmp/ansible_juniper.device.command_payload_gx_z54jo/ansible_juniper.device.command_payload.zip/ansible_collections/juniper/device/plugins/modules/command.py", line 300, in main
File "/tmp/ansible_juniper.device.command_payload_gx_z54jo/ansible_juniper.device.command_payload.zip/ansible_collections/juniper/device/plugins/module_utils/juniper_junos_common.py", line 659, in __init__
File "/tmp/ansible_juniper.device.command_payload_gx_z54jo/ansible_juniper.device.command_payload.zip/ansible_collections/juniper/device/plugins/module_utils/configuration.py", line 291, in check_sw_compatibility
File "/tmp/ansible_juniper.device.command_payload_gx_z54jo/ansible_juniper.device.command_payload.zip/ansible_collections/juniper/device/plugins/module_utils/configuration.py", line 200, in check_pyez
File "/tmp/ansible_juniper.device.command_payload_gx_z54jo/ansible_juniper.device.command_payload.zip/ansible_collections/juniper/device/plugins/module_utils/configuration.py", line 168, in _check_library
NameError: name 'LooseVersion' is not defined
fatal: [a01.testtx03.us.bb]: FAILED! => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": false,
"module_stderr": "Traceback (most recent call last):\n File \"/home/josephn/tmp/.ansible/ansible-tmp-1734733433.9948735-1257834-271372075631705/AnsiballZ_command.py\", line 107, in <module>\n _ansiballz_main()\n File \"/home/josephn/tmp/.ansible/ansible-tmp-1734733433.9948735-1257834-271372075631705/AnsiballZ_command.py\", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/josephn/tmp/.ansible/ansible-tmp-1734733433.9948735-1257834-271372075631705/AnsiballZ_command.py\", line 47, in invoke_module\n runpy.run_module(mod_name='ansible_collections.juniper.device.plugins.modules.command', init_globals=dict(_module_fqn='ansible_collections.juniper.device.plugins.modules.command', _modlib_path=modlib_path),\n File \"/usr/lib/python3.10/runpy.py\", line 224, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib/python3.10/runpy.py\", line 96, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File \"/usr/lib/python3.10/runpy.py\", line 86, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_juniper.device.command_payload_gx_z54jo/ansible_juniper.device.command_payload.zip/ansible_collections/juniper/device/plugins/modules/command.py\", line 504, in <module>\n File \"/tmp/ansible_juniper.device.command_payload_gx_z54jo/ansible_juniper.device.command_payload.zip/ansible_collections/juniper/device/plugins/modules/command.py\", line 300, in main\n File \"/tmp/ansible_juniper.device.command_payload_gx_z54jo/ansible_juniper.device.command_payload.zip/ansible_collections/juniper/device/plugins/module_utils/juniper_junos_common.py\", line 659, in __init__\n File \"/tmp/ansible_juniper.device.command_payload_gx_z54jo/ansible_juniper.device.command_payload.zip/ansible_collections/juniper/device/plugins/module_utils/configuration.py\", line 291, in check_sw_compatibility\n File \"/tmp/ansible_juniper.device.command_payload_gx_z54jo/ansible_juniper.device.command_payload.zip/ansible_collections/juniper/device/plugins/module_utils/configuration.py\", line 200, in check_pyez\n File \"/tmp/ansible_juniper.device.command_payload_gx_z54jo/ansible_juniper.device.command_payload.zip/ansible_collections/juniper/device/plugins/module_utils/configuration.py\", line 168, in _check_library\nNameError: name 'LooseVersion' is not defined\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}
[WARNING]: Failure using method (v2_runner_on_failed) in callback plugin (<ansible_collections.community.general.plugins.callback.log_plays.CallbackModule
object at 0x7f194eb13670>): [Errno 2] No such file or directory: '~/ansible_logs/logs/a01.testtx03.us.bb'
Callback Exception:
File "/usr/local/lib/python3.10/dist-packages/ansible/executor/task_queue_manager.py", line 468, in send_callback
method(*new_args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/ansible_collections/community/general/plugins/callback/log_plays.py", line 104, in v2_runner_on_failed
self.log(result, 'FAILED')
File "/usr/local/lib/python3.10/dist-packages/ansible_collections/community/general/plugins/callback/log_plays.py", line 100, in log
with open(path, "ab") as fd:
Steps to reproduce
Ran the playbook below
---
- name: AWX Test File
hosts: all
ignore_unreachable: true
gather_facts: false
vars:
ansible_host_key_checking: false
tasks:
- name: Generate RSI
juniper.device.command:
command:
- request support information
dest: "{{ inventory_hostname }}_rsi.txt"
formats: text
return_output: false # Will not return output to Ansible (output is too large)
huge_tree: true # Will not fail if output is too large
timeout: 1800
Expected results
I expected the playbook to generate a file with RSI output from the router in my local directory. It works fine if I lower the version of juniper.device to 1.0.6 or 1.0.5. This broke yesterday when 1.0.7 was released. My AWX EE was setup to pull newer versions and I fixed my issues but removing that functionality.
Actual results
ansible-playbook -l router_name awx_test.yaml -vvvv
ansible-playbook [core 2.15.6]
config file = /home/username/projects/operational-ansible-playbooks/ansible.cfg
configured module search path = ['/home/username/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.10/dist-packages/ansible
ansible collection location = /home/username/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible-playbook
python version = 3.10.12 (main, Nov 6 2024, 20:22:13) [GCC 11.4.0] (/usr/bin/python3)
jinja version = 3.1.2
libyaml = True
Using /home/username/projects/operational-ansible-playbooks/ansible.cfg as config file
setting up inventory plugins
Loading collection ansible.builtin from
host_list declined parsing /home/username/projects/operational-ansible-playbooks/inventory/gums_devices as it did not pass its verify_file() method
Parsed /home/username/projects/operational-ansible-playbooks/inventory/gums_devices inventory source with script plugin
/usr/lib/python3/dist-packages/requests/__init__.py:87: RequestsDependencyWarning: urllib3 (2.1.0) or chardet (4.0.0) doesn't match a supported version!
warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "
Loading collection juniper.device from /usr/local/lib/python3.10/dist-packages/ansible_collections/juniper/device
Loading callback plugin default of type stdout, v2.0 from /usr/local/lib/python3.10/dist-packages/ansible/plugins/callback/default.py
Loading collection ansible.posix from /usr/local/lib/python3.10/dist-packages/ansible_collections/ansible/posix
Loading collection community.general from /usr/local/lib/python3.10/dist-packages/ansible_collections/community/general
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.
Loading callback plugin ansible.posix.profile_tasks of type aggregate, v2.0 from /usr/local/lib/python3.10/dist-packages/ansible_collections/ansible/posix/plugins/callback/profile_tasks.py
Loading callback plugin ansible.posix.timer of type aggregate, v2.0 from /usr/local/lib/python3.10/dist-packages/ansible_collections/ansible/posix/plugins/callback/timer.py
Loading callback plugin community.general.log_plays of type notification, v2.0 from /usr/local/lib/python3.10/dist-packages/ansible_collections/community/general/plugins/callback/log_plays.py
PLAYBOOK: awx_test.yaml ***************************************************************************************************************************************
Positional arguments: awx_test.yaml
verbosity: 4
connection: smart
timeout: 10
become_method: sudo
tags: ('all',)
inventory: ('/home/username/projects/operational-ansible-playbooks/inventory',)
subset: router_name
forks: 3
1 plays in awx_test.yaml
Read vars_file 'vars/shared_vars.yaml'
Read vars_file 'vars/os_revision_vars.yaml'
Read vars_file 'vars/shared_vars.yaml'
Read vars_file 'vars/os_revision_vars.yaml'
Read vars_file 'vars/shared_vars.yaml'
Read vars_file 'vars/os_revision_vars.yaml'
PLAY [Awx_test_file] ******************************************************************************************************************************************
Read vars_file 'vars/shared_vars.yaml'
Read vars_file 'vars/os_revision_vars.yaml'
Read vars_file 'vars/shared_vars.yaml'
Read vars_file 'vars/os_revision_vars.yaml'
Read vars_file 'vars/shared_vars.yaml'
Read vars_file 'vars/os_revision_vars.yaml'
TASK [Generate RSI] *******************************************************************************************************************************************
task path: /home/username/projects/operational-ansible-playbooks/awx_test.yaml:16
Friday 20 December 2024 22:23:53 +0000 (0:00:00.120) 0:00:00.120 *******
<router_name> ESTABLISH LOCAL CONNECTION FOR USER: username
<router_name> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/tmp/.ansible `"&& mkdir "` echo $HOME/tmp/.ansible/ansible-tmp-1734733433.9948735-1257834-271372075631705 `" && echo ansible-tmp-1734733433.9948735-1257834-271372075631705="` echo $HOME/tmp/.ansible/ansible-tmp-1734733433.9948735-1257834-271372075631705 `" ) && sleep 0'
<router_name> Attempting python interpreter discovery
<router_name> EXEC /bin/sh -c 'echo PLATFORM; uname; echo FOUND; command -v '"'"'python3.11'"'"'; command -v '"'"'python3.10'"'"'; command -v '"'"'python3.9'"'"'; command -v '"'"'python3.8'"'"'; command -v '"'"'python3.7'"'"'; command -v '"'"'python3.6'"'"'; command -v '"'"'python3.5'"'"'; command -v '"'"'/usr/bin/python3'"'"'; command -v '"'"'/usr/libexec/platform-python'"'"'; command -v '"'"'python2.7'"'"'; command -v '"'"'/usr/bin/python'"'"'; command -v '"'"'python'"'"'; echo ENDFOUND && sleep 0'
<router_name> EXEC /bin/sh -c '/usr/bin/python3.11 && sleep 0'
Using module file /usr/local/lib/python3.10/dist-packages/ansible_collections/juniper/device/plugins/modules/command.py
<router_name> PUT /home/username/.ansible/tmp/ansible-local-1257822x88qkl_4/tmpzxcfm6ul TO /home/username/tmp/.ansible/ansible-tmp-1734733433.9948735-1257834-271372075631705/AnsiballZ_command.py
<router_name> EXEC /bin/sh -c 'chmod u+x /home/username/tmp/.ansible/ansible-tmp-1734733433.9948735-1257834-271372075631705/ /home/username/tmp/.ansible/ansible-tmp-1734733433.9948735-1257834-271372075631705/AnsiballZ_command.py && sleep 0'
<router_name> EXEC /bin/sh -c '/usr/bin/python3 /home/username/tmp/.ansible/ansible-tmp-1734733433.9948735-1257834-271372075631705/AnsiballZ_command.py && sleep 0'
<router_name> EXEC /bin/sh -c 'rm -f -r /home/username/tmp/.ansible/ansible-tmp-1734733433.9948735-1257834-271372075631705/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
Traceback (most recent call last):
File "/home/username/tmp/.ansible/ansible-tmp-1734733433.9948735-1257834-271372075631705/AnsiballZ_command.py", line 107, in <module>
_ansiballz_main()
File "/home/username/tmp/.ansible/ansible-tmp-1734733433.9948735-1257834-271372075631705/AnsiballZ_command.py", line 99, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/home/username/tmp/.ansible/ansible-tmp-1734733433.9948735-1257834-271372075631705/AnsiballZ_command.py", line 47, in invoke_module
runpy.run_module(mod_name='ansible_collections.juniper.device.plugins.modules.command', init_globals=dict(_module_fqn='ansible_collections.juniper.device.plugins.modules.command', _modlib_path=modlib_path),
File "/usr/lib/python3.10/runpy.py", line 224, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "/usr/lib/python3.10/runpy.py", line 96, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/tmp/ansible_juniper.device.command_payload_gx_z54jo/ansible_juniper.device.command_payload.zip/ansible_collections/juniper/device/plugins/modules/command.py", line 504, in <module>
File "/tmp/ansible_juniper.device.command_payload_gx_z54jo/ansible_juniper.device.command_payload.zip/ansible_collections/juniper/device/plugins/modules/command.py", line 300, in main
File "/tmp/ansible_juniper.device.command_payload_gx_z54jo/ansible_juniper.device.command_payload.zip/ansible_collections/juniper/device/plugins/module_utils/juniper_junos_common.py", line 659, in __init__
File "/tmp/ansible_juniper.device.command_payload_gx_z54jo/ansible_juniper.device.command_payload.zip/ansible_collections/juniper/device/plugins/module_utils/configuration.py", line 291, in check_sw_compatibility
File "/tmp/ansible_juniper.device.command_payload_gx_z54jo/ansible_juniper.device.command_payload.zip/ansible_collections/juniper/device/plugins/module_utils/configuration.py", line 200, in check_pyez
File "/tmp/ansible_juniper.device.command_payload_gx_z54jo/ansible_juniper.device.command_payload.zip/ansible_collections/juniper/device/plugins/module_utils/configuration.py", line 168, in _check_library
NameError: name 'LooseVersion' is not defined
fatal: [router_name]: FAILED! => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": false,
"module_stderr": "Traceback (most recent call last):\n File \"/home/username/tmp/.ansible/ansible-tmp-1734733433.9948735-1257834-271372075631705/AnsiballZ_command.py\", line 107, in <module>\n _ansiballz_main()\n File \"/home/username/tmp/.ansible/ansible-tmp-1734733433.9948735-1257834-271372075631705/AnsiballZ_command.py\", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/username/tmp/.ansible/ansible-tmp-1734733433.9948735-1257834-271372075631705/AnsiballZ_command.py\", line 47, in invoke_module\n runpy.run_module(mod_name='ansible_collections.juniper.device.plugins.modules.command', init_globals=dict(_module_fqn='ansible_collections.juniper.device.plugins.modules.command', _modlib_path=modlib_path),\n File \"/usr/lib/python3.10/runpy.py\", line 224, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib/python3.10/runpy.py\", line 96, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File \"/usr/lib/python3.10/runpy.py\", line 86, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_juniper.device.command_payload_gx_z54jo/ansible_juniper.device.command_payload.zip/ansible_collections/juniper/device/plugins/modules/command.py\", line 504, in <module>\n File \"/tmp/ansible_juniper.device.command_payload_gx_z54jo/ansible_juniper.device.command_payload.zip/ansible_collections/juniper/device/plugins/modules/command.py\", line 300, in main\n File \"/tmp/ansible_juniper.device.command_payload_gx_z54jo/ansible_juniper.device.command_payload.zip/ansible_collections/juniper/device/plugins/module_utils/juniper_junos_common.py\", line 659, in __init__\n File \"/tmp/ansible_juniper.device.command_payload_gx_z54jo/ansible_juniper.device.command_payload.zip/ansible_collections/juniper/device/plugins/module_utils/configuration.py\", line 291, in check_sw_compatibility\n File \"/tmp/ansible_juniper.device.command_payload_gx_z54jo/ansible_juniper.device.command_payload.zip/ansible_collections/juniper/device/plugins/module_utils/configuration.py\", line 200, in check_pyez\n File \"/tmp/ansible_juniper.device.command_payload_gx_z54jo/ansible_juniper.device.command_payload.zip/ansible_collections/juniper/device/plugins/module_utils/configuration.py\", line 168, in _check_library\nNameError: name 'LooseVersion' is not defined\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}
[WARNING]: Failure using method (v2_runner_on_failed) in callback plugin (<ansible_collections.community.general.plugins.callback.log_plays.CallbackModule
object at 0x7f194eb13670>): [Errno 2] No such file or directory: '~/ansible_logs/logs/router_name'
Callback Exception:
File "/usr/local/lib/python3.10/dist-packages/ansible/executor/task_queue_manager.py", line 468, in send_callback
method(*new_args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/ansible_collections/community/general/plugins/callback/log_plays.py", line 104, in v2_runner_on_failed
self.log(result, 'FAILED')
File "/usr/local/lib/python3.10/dist-packages/ansible_collections/community/general/plugins/callback/log_plays.py", line 100, in log
with open(path, "ab") as fd:
PLAY RECAP ****************************************************************************************************************************************************
router_name : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
Friday 20 December 2024 22:23:54 +0000 (0:00:00.645) 0:00:00.765 *******
===============================================================================
Generate RSI ------------------------------------------------------------------------------------------------------------------------------------------- 0.65s
/home/username/projects/operational-ansible-playbooks/awx_test.yaml:16 ----------------------------------------------------------------------------------------
Playbook run took 0 days, 0 hours, 0 minutes, 0 seconds
The text was updated successfully, but these errors were encountered:
Issue Type
Module Name
juniper.device
juniper.device collection and Python libraries version
OS / Environment
Ubuntu 22.04
Summary
I get the following error when trying to run a command using juniper.device.command using juniper.device version 1.0.7
Steps to reproduce
Ran the playbook below
Expected results
I expected the playbook to generate a file with RSI output from the router in my local directory. It works fine if I lower the version of juniper.device to 1.0.6 or 1.0.5. This broke yesterday when 1.0.7 was released. My AWX EE was setup to pull newer versions and I fixed my issues but removing that functionality.
Actual results
The text was updated successfully, but these errors were encountered: