Skip to content

Commit

Permalink
The validate_certs parameter had no effect if the retries parameter w…
Browse files Browse the repository at this point in the history
…as set. Fix now also sets the parameter correctly in the retry request session

Closes ansible-collections#461
  • Loading branch information
argetlam-coder committed Dec 14, 2024
1 parent afc77bd commit 64e16e4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions changelogs/fragments/459-validate-certs-fix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
bugfixes:
- connection_options - the validate_certs parameter had no effect if the retries parameter was set. Fix now also sets the parameter correctly in the retry request session (https://github.com/ansible-collections/community.hashi_vault/issues/461).
5 changes: 3 additions & 2 deletions plugins/module_utils/_connection_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def _filter(k, v):

retry_action = hvopts.pop('retry_action')
if 'retries' in hvopts:
hvopts['session'] = self._get_custom_requests_session(new_callback=self._retry_callback_generator(retry_action), **hvopts.pop('retries'))
hvopts['session'] = self._get_custom_requests_session(new_callback=self._retry_callback_generator(retry_action), conopt_verify=self._conopt_verify, **hvopts.pop('retries'))

return hvopts

Expand All @@ -120,7 +120,7 @@ def process_connection_options(self):
self._process_option_proxies()
self._process_option_retries()

def _get_custom_requests_session(self, **retry_kwargs):
def _get_custom_requests_session(self, conopt_verify, **retry_kwargs):
'''returns a requests.Session to pass to hvac (or None)'''

if not HAS_RETRIES:
Expand Down Expand Up @@ -159,6 +159,7 @@ def new(self, **kwargs):
sess = Session()
sess.mount("https://", adapter)
sess.mount("http://", adapter)
sess.verify = conopt_verify

return sess

Expand Down

0 comments on commit 64e16e4

Please sign in to comment.