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.
pull/28416/merge
Guido Günther 7 years ago committed by ansibot
parent e1def05ba2
commit 398f643c58

@ -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

Loading…
Cancel
Save