Open CompPhy opened 1 month ago
Yes, I do know this traceback says Python 3.9... That's because we used Ansible Automation Platform for this first attempt, and execution environments there are based on Python 3.9 at the moment. We did however re-test these same conditions on a development machine, using Python 3.11, and got the exact same results.
Ansible NetBox Collection version
v3.19.1
Ansible version
NetBox version
v4.0.5
Python version
3.11
Steps to Reproduce
I'm not really sure if this is an issue with the ansible module itself, but might actually be an issue with the pynetbox module. I'm sure the maintainers will have a better idea.
1) Create a redirect scenario on the Netbox server. In our example, we are just trying to redirect HTTP -> HTTPS. 2) Use one of the ansible modules to make a call through the first URL, which should get redirected as part of the initial connection. 3) Instead of following the redirect, or giving a failure to connect error, the code instead continues.... 4) The end result is a useless traceback later in the code, when it gets to checking the netbox version number. This happens in different places depending on which specific module is being called.
Expected Behavior
One would expect one of two outcomes here:
1) The call follows HTTP redirect, as most would expect, and succeeds on the updated URL. 2) The call throws a connection failure message, instead of a random traceback later in the code. This could at least give some better feedback on checking connection variables.
Observed Behavior
We were able to work around this issue by updating our ansible variables to the new HTTPS URL, but one really would expect that any request here just follows the redirect. Our server is handing out a proper 301 Moved Permanently code here.
That doesn't appear to be what's happening, as the below traceback doesn't say anything about the connection failing. We only found the fix because we were double checking all our variables and notice we didn't update the URL after recently adding HTTPS.
I'm not sure if this is just not following redirects, or if the netbox module isn't handling connection errors in general. Either way, Ansible has "unreachable" status messages and one would except to get some kind of reasonable feedback that this was a connection failure. Or, better yet, just follow the redirect which would have allowed things to continue here.