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
When NTP is configured and when DELETE ALL is performed, it fails.
Product Name
eSONiC Collections
Component or Module Name
sonic_ntp
DellEMC Enterprise SONiC Ansible Collection Version
2.0
SONiC Software Version
4.0
Configuration
NTP is configured using CLI as follows.
show ntp global
NTP Global Configuration
NTP authenticate: Yes
show ntp server
NTP Servers minpoll maxpoll Prefer Authentication key ID
1.1.1.1 6 10 False
Steps to Reproduce
After configuring, ran the following playbook to delete all NTP config.
name: Ansible resource module example for sonic_aaa
hosts: datacenter
gather_facts: False
connection: httpapi
collections:
dellemc.enterprise_sonic
tasks:
name: Delete NTP server configuration
sonic_ntp:
state: deleted
Expected Behavior
It should delete all NTP configs.
Actual Behavior
It throws an error as follows.
TASK [Delete NTP server configuration] *****************************************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'list' object has no attribute 'get'
fatal: [sonic1]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File "/root/.ansible/tmp/ansible-local-20769koewrw01/ansible-tmp-1680283498.5821176-20773-245238821663001/AnsiballZ_sonic_ntp.py", line 107, in \n _ansiballz_main()\n File "/root/.ansible/tmp/ansible-local-20769koewrw01/ansible-tmp-1680283498.5821176-20773-245238821663001/AnsiballZ_sonic_ntp.py", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File "/root/.ansible/tmp/ansible-local-20769koewrw01/ansible-tmp-1680283498.5821176-20773-245238821663001/AnsiballZ_sonic_ntp.py", line 47, in invoke_module\n runpy.run_module(mod_name='ansible_collections.dellemc.enterprise_sonic.plugins.modules.sonic_ntp', init_globals=dict(_module_fqn='ansible_collections.dellemc.enterprise_sonic.plugins.modules.sonic_ntp', _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_sonic_ntp_payload_ohj2ff6n/ansible_sonic_ntp_payload.zip/ansible_collections/dellemc/enterprise_sonic/plugins/modules/sonic_ntp.py", line 450, in \n File "/tmp/ansible_sonic_ntp_payload_ohj2ff6n/ansible_sonic_ntp_payload.zip/ansible_collections/dellemc/enterprise_sonic/plugins/modules/sonic_ntp.py", line 445, in main\n File "/tmp/ansible_sonic_ntp_payload_ohj2ff6n/ansible_sonic_ntp_payload.zip/ansible_collections/dellemc/enterprise_sonic/plugins/module_utils/network/sonic/config/ntp/ntp.py", line 89, in execute_module\n File "/tmp/ansible_sonic_ntp_payload_ohj2ff6n/ansible_sonic_ntp_payload.zip/ansible_collections/dellemc/enterprise_sonic/plugins/module_utils/network/sonic/config/ntp/ntp.py", line 123, in set_config\n File "/tmp/ansible_sonic_ntp_payload_ohj2ff6n/ansible_sonic_ntp_payload.zip/ansible_collections/dellemc/enterprise_sonic/plugins/module_utils/network/sonic/config/ntp/ntp.py", line 139, in set_state\n File "/tmp/ansible_sonic_ntp_payload_ohj2ff6n/ansible_sonic_ntp_payload.zip/ansible_collections/dellemc/enterprise_sonic/plugins/module_utils/network/sonic/config/ntp/ntp.py", line 314, in preprocess_want\nAttributeError: 'list' object has no attribute 'get'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
Logs
TASK [Delete NTP server configuration] *****************************************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'list' object has no attribute 'get'
fatal: [sonic1]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File "/root/.ansible/tmp/ansible-local-20769koewrw01/ansible-tmp-1680283498.5821176-20773-245238821663001/AnsiballZ_sonic_ntp.py", line 107, in \n _ansiballz_main()\n File "/root/.ansible/tmp/ansible-local-20769koewrw01/ansible-tmp-1680283498.5821176-20773-245238821663001/AnsiballZ_sonic_ntp.py", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File "/root/.ansible/tmp/ansible-local-20769koewrw01/ansible-tmp-1680283498.5821176-20773-245238821663001/AnsiballZ_sonic_ntp.py", line 47, in invoke_module\n runpy.run_module(mod_name='ansible_collections.dellemc.enterprise_sonic.plugins.modules.sonic_ntp', init_globals=dict(_module_fqn='ansible_collections.dellemc.enterprise_sonic.plugins.modules.sonic_ntp', _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_sonic_ntp_payload_ohj2ff6n/ansible_sonic_ntp_payload.zip/ansible_collections/dellemc/enterprise_sonic/plugins/modules/sonic_ntp.py", line 450, in \n File "/tmp/ansible_sonic_ntp_payload_ohj2ff6n/ansible_sonic_ntp_payload.zip/ansible_collections/dellemc/enterprise_sonic/plugins/modules/sonic_ntp.py", line 445, in main\n File "/tmp/ansible_sonic_ntp_payload_ohj2ff6n/ansible_sonic_ntp_payload.zip/ansible_collections/dellemc/enterprise_sonic/plugins/module_utils/network/sonic/config/ntp/ntp.py", line 89, in execute_module\n File "/tmp/ansible_sonic_ntp_payload_ohj2ff6n/ansible_sonic_ntp_payload.zip/ansible_collections/dellemc/enterprise_sonic/plugins/module_utils/network/sonic/config/ntp/ntp.py", line 123, in set_config\n File "/tmp/ansible_sonic_ntp_payload_ohj2ff6n/ansible_sonic_ntp_payload.zip/ansible_collections/dellemc/enterprise_sonic/plugins/module_utils/network/sonic/config/ntp/ntp.py", line 139, in set_state\n File "/tmp/ansible_sonic_ntp_payload_ohj2ff6n/ansible_sonic_ntp_payload.zip/ansible_collections/dellemc/enterprise_sonic/plugins/module_utils/network/sonic/config/ntp/ntp.py", line 314, in preprocess_want\nAttributeError: 'list' object has no attribute 'get'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
Screenshots
No response
Additional Information
In plugins/module_utils/network/sonic/config/ntp/ntp.py, function preprocess_want is accessing "want" variable even for DELETE_ALL. In case of DELETE_ALL, want will be NULL.
The text was updated successfully, but these errors were encountered:
plugins/module_utils/network/sonic/config/ntp/ntp.py, function preprocess_want
Buggy line: if state == 'deleted':
POSSIBLE SOLUTION: if want and state == 'deleted':
Bug Description
When NTP is configured and when DELETE ALL is performed, it fails.
Product Name
eSONiC Collections
Component or Module Name
sonic_ntp
DellEMC Enterprise SONiC Ansible Collection Version
2.0
SONiC Software Version
4.0
Configuration
NTP is configured using CLI as follows.
show ntp global
NTP Global Configuration
NTP authenticate: Yes
show ntp server
NTP Servers minpoll maxpoll Prefer Authentication key ID
1.1.1.1 6 10 False
Steps to Reproduce
After configuring, ran the following playbook to delete all NTP config.
hosts: datacenter
gather_facts: False
connection: httpapi
collections:
tasks:
sonic_ntp:
state: deleted
Expected Behavior
It should delete all NTP configs.
Actual Behavior
It throws an error as follows.
TASK [Delete NTP server configuration] *****************************************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'list' object has no attribute 'get'
fatal: [sonic1]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File "/root/.ansible/tmp/ansible-local-20769koewrw01/ansible-tmp-1680283498.5821176-20773-245238821663001/AnsiballZ_sonic_ntp.py", line 107, in \n _ansiballz_main()\n File "/root/.ansible/tmp/ansible-local-20769koewrw01/ansible-tmp-1680283498.5821176-20773-245238821663001/AnsiballZ_sonic_ntp.py", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File "/root/.ansible/tmp/ansible-local-20769koewrw01/ansible-tmp-1680283498.5821176-20773-245238821663001/AnsiballZ_sonic_ntp.py", line 47, in invoke_module\n runpy.run_module(mod_name='ansible_collections.dellemc.enterprise_sonic.plugins.modules.sonic_ntp', init_globals=dict(_module_fqn='ansible_collections.dellemc.enterprise_sonic.plugins.modules.sonic_ntp', _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_sonic_ntp_payload_ohj2ff6n/ansible_sonic_ntp_payload.zip/ansible_collections/dellemc/enterprise_sonic/plugins/modules/sonic_ntp.py", line 450, in \n File "/tmp/ansible_sonic_ntp_payload_ohj2ff6n/ansible_sonic_ntp_payload.zip/ansible_collections/dellemc/enterprise_sonic/plugins/modules/sonic_ntp.py", line 445, in main\n File "/tmp/ansible_sonic_ntp_payload_ohj2ff6n/ansible_sonic_ntp_payload.zip/ansible_collections/dellemc/enterprise_sonic/plugins/module_utils/network/sonic/config/ntp/ntp.py", line 89, in execute_module\n File "/tmp/ansible_sonic_ntp_payload_ohj2ff6n/ansible_sonic_ntp_payload.zip/ansible_collections/dellemc/enterprise_sonic/plugins/module_utils/network/sonic/config/ntp/ntp.py", line 123, in set_config\n File "/tmp/ansible_sonic_ntp_payload_ohj2ff6n/ansible_sonic_ntp_payload.zip/ansible_collections/dellemc/enterprise_sonic/plugins/module_utils/network/sonic/config/ntp/ntp.py", line 139, in set_state\n File "/tmp/ansible_sonic_ntp_payload_ohj2ff6n/ansible_sonic_ntp_payload.zip/ansible_collections/dellemc/enterprise_sonic/plugins/module_utils/network/sonic/config/ntp/ntp.py", line 314, in preprocess_want\nAttributeError: 'list' object has no attribute 'get'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
Logs
TASK [Delete NTP server configuration] *****************************************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'list' object has no attribute 'get'
fatal: [sonic1]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File "/root/.ansible/tmp/ansible-local-20769koewrw01/ansible-tmp-1680283498.5821176-20773-245238821663001/AnsiballZ_sonic_ntp.py", line 107, in \n _ansiballz_main()\n File "/root/.ansible/tmp/ansible-local-20769koewrw01/ansible-tmp-1680283498.5821176-20773-245238821663001/AnsiballZ_sonic_ntp.py", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File "/root/.ansible/tmp/ansible-local-20769koewrw01/ansible-tmp-1680283498.5821176-20773-245238821663001/AnsiballZ_sonic_ntp.py", line 47, in invoke_module\n runpy.run_module(mod_name='ansible_collections.dellemc.enterprise_sonic.plugins.modules.sonic_ntp', init_globals=dict(_module_fqn='ansible_collections.dellemc.enterprise_sonic.plugins.modules.sonic_ntp', _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_sonic_ntp_payload_ohj2ff6n/ansible_sonic_ntp_payload.zip/ansible_collections/dellemc/enterprise_sonic/plugins/modules/sonic_ntp.py", line 450, in \n File "/tmp/ansible_sonic_ntp_payload_ohj2ff6n/ansible_sonic_ntp_payload.zip/ansible_collections/dellemc/enterprise_sonic/plugins/modules/sonic_ntp.py", line 445, in main\n File "/tmp/ansible_sonic_ntp_payload_ohj2ff6n/ansible_sonic_ntp_payload.zip/ansible_collections/dellemc/enterprise_sonic/plugins/module_utils/network/sonic/config/ntp/ntp.py", line 89, in execute_module\n File "/tmp/ansible_sonic_ntp_payload_ohj2ff6n/ansible_sonic_ntp_payload.zip/ansible_collections/dellemc/enterprise_sonic/plugins/module_utils/network/sonic/config/ntp/ntp.py", line 123, in set_config\n File "/tmp/ansible_sonic_ntp_payload_ohj2ff6n/ansible_sonic_ntp_payload.zip/ansible_collections/dellemc/enterprise_sonic/plugins/module_utils/network/sonic/config/ntp/ntp.py", line 139, in set_state\n File "/tmp/ansible_sonic_ntp_payload_ohj2ff6n/ansible_sonic_ntp_payload.zip/ansible_collections/dellemc/enterprise_sonic/plugins/module_utils/network/sonic/config/ntp/ntp.py", line 314, in preprocess_want\nAttributeError: 'list' object has no attribute 'get'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
Screenshots
No response
Additional Information
In plugins/module_utils/network/sonic/config/ntp/ntp.py, function preprocess_want is accessing "want" variable even for DELETE_ALL. In case of DELETE_ALL, want will be NULL.
The text was updated successfully, but these errors were encountered: