1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Check existence of SSL certs in Foreman callback (#25796)

* Fix typo

* foreman callback: check existence off SSL certs

This leads to confusing error messages later on otherwise.
This commit is contained in:
Guido Günther 2017-08-22 20:25:14 +02:00 committed by ansibot
parent e1def05ba2
commit 398f643c58

View file

@ -82,6 +82,13 @@ class CallbackModule(CallbackBase):
else:
self._disable_plugin('The `requests` python module is not installed.')
if self.FOREMAN_URL.startswith('https://'):
if not os.path.exists(self.FOREMAN_SSL_CERT[0]):
self._disable_plugin('FOREMAN_SSL_CERT %s not found.' % self.FOREMAN_SSL_CERT[0])
if not os.path.exists(self.FOREMAN_SSL_CERT[1]):
self._disable_plugin('FOREMAN_SSL_KEY %s not found.' % self.FOREMAN_SSL_CERT[1])
def _disable_plugin(self, msg):
self.disabled = True
self._display.warning(msg + ' Disabling the Foreman callback plugin.')
@ -94,7 +101,7 @@ class CallbackModule(CallbackBase):
self._display.warning("SSL verification of %s disabled" %
self.FOREMAN_URL)
verify = False
else: # Set ta a CA bundle:
else: # Set to a CA bundle:
verify = self.FOREMAN_SSL_VERIFY
return verify