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
SWITCH(config)# show ntp servers
NTP Server Information
No NTP server configuration details found!
The command "config_ntp_ipv4addr" fail and return : unable to load response from device
Debug
To debug I used packet analyzer like Wireshark/tcpdump tool and trace values of variable in .ansible/collections/ansible_collections/arubanetworks/aos_switch/plugins/module_utils/arubaoss.py
For idempotent, the module try to delete config before send new config. But when config not exist, switch return (legitimately) a 404 error.
Network analyzer extraction :
DELETE /rest/v8.0/config/ntp/server/ip4addr/10.150.17.10 HTTP/1.1
Accept-Encoding: identity
Content-Length: 156
Host: 172.25.0.201:443
User-Agent: ansible-httpget
Content-Type: application/json
Cookie: sessionId=KZxPVyULSRfvMRqlbh4FUKnBZsMCMzokbN9bqO5Ihxhso127nfp3g5lhAOAnP1o
Connection: close
{"ip4addr": {"ip4addr_reference": {"max-poll": {"max-poll_value": 10}, "min-poll": {"min-poll_value": 6}, "iburst": true}, "ip4addr_value": "10.150.17.10"}}HTTP/1.1 404 Not Found
Server: eHTTP v2.0
Content-Length: 38
Date: Thu, 01 Jan 1970 04:51:15 GMT
RequestId: (null)
Connection: close
{
"message": "Error 404: Not Found."
}
And module fail.
Of course, if have already set the switch with the good configuration and run ansible module success.
In this case module return ok without change configuration, (that is normal)
Another trace of module variable confirm this behavior : data={"ip4addr": {"ip4addr_reference": {"max-poll": {"max-poll_value": 10}, "min-poll": {"min-poll_value": 6}, "iburst": true}, "ip4addr_value": "10.150.17.10"}} url=https://172.25.0.201:443/rest/v8.0/config/ntp/server/ip4addr/10.150.17.10 method=DELETE header={'url': 'https://172.25.0.201:443/rest/v8.0/config/ntp/server/ip4addr/10.150.17.10', 'status': 404, 'server': 'eHTTP v2.0', 'content-length': '38', 'date': 'Tue, 06 Jan 1970 16:48:36 GMT', 'requestid': '(null)', 'connection': 'close', 'msg': 'HTTP Error 404: Not Found', 'body': b'{\n"message": "Error 404: Not Found."\n}'}
___response=HTTP Error 404: Not Found___HTTP Error 404: Not Found
An (ugly) workaround consist to consider an 404 error to return a success.
I edited "run_commands" function in ".ansible/collections/ansible_collections/arubanetworks/aos_switch/plugins/module_utils/arubaoss.py" file and edit code like :
Before
if headers['status'] == 204:
return {'msg': 'Successful', 'changed': True}
After
if headers['status'] == 204 or headers['status'] == 404:
return {'msg': 'Successful', 'changed': True}
And script work like expected behavior.
The text was updated successfully, but these errors were encountered:
I'm opening this issue following a problem I published here : #72 (comment)
Version
Switch Aruba JL261A (firmware #WC.16.11.0016)
Ansible 2.14.9
Aruba aos_switch 1.7
Configuration
Following this ansible configuration :
And without any ntp configured on switch :
The command "config_ntp_ipv4addr" fail and return :
unable to load response from device
Debug
To debug I used packet analyzer like Wireshark/tcpdump tool and trace values of variable in .ansible/collections/ansible_collections/arubanetworks/aos_switch/plugins/module_utils/arubaoss.py
For idempotent, the module try to delete config before send new config. But when config not exist, switch return (legitimately) a 404 error.
Network analyzer extraction :
And module fail.
Of course, if have already set the switch with the good configuration and run ansible module success.
In this case module return ok without change configuration, (that is normal)
Another trace of module variable confirm this behavior :
data={"ip4addr": {"ip4addr_reference": {"max-poll": {"max-poll_value": 10}, "min-poll": {"min-poll_value": 6}, "iburst": true}, "ip4addr_value": "10.150.17.10"}}
url=https://172.25.0.201:443/rest/v8.0/config/ntp/server/ip4addr/10.150.17.10
method=DELETE
header={'url': 'https://172.25.0.201:443/rest/v8.0/config/ntp/server/ip4addr/10.150.17.10', 'status': 404, 'server': 'eHTTP v2.0', 'content-length': '38', 'date': 'Tue, 06 Jan 1970 16:48:36 GMT', 'requestid': '(null)', 'connection': 'close', 'msg': 'HTTP Error 404: Not Found', 'body': b'{\n"message": "Error 404: Not Found."\n}'}
___response=HTTP Error 404: Not Found___HTTP Error 404: Not Found
An (ugly) workaround consist to consider an 404 error to return a success.
I edited "run_commands" function in ".ansible/collections/ansible_collections/arubanetworks/aos_switch/plugins/module_utils/arubaoss.py" file and edit code like :
Before
After
And script work like expected behavior.
The text was updated successfully, but these errors were encountered: