From: Ward Vandewege Date: Wed, 30 May 2018 20:03:59 +0000 (-0400) Subject: 13547: make the Python SDK respect the ARVADOS_API_HOST_INSECURE environment X-Git-Tag: 1.2.0~92^2~5 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/cdd57a73f2f90d6b14b8652ab94adc14e4b99c8b 13547: make the Python SDK respect the ARVADOS_API_HOST_INSECURE environment variable when speaking with keep over SSL refs #13547 Arvados-DCO-1.1-Signed-off-by: Ward Vandewege --- diff --git a/sdk/python/arvados/keep.py b/sdk/python/arvados/keep.py index e8e95afc70..1150bb6b4e 100644 --- a/sdk/python/arvados/keep.py +++ b/sdk/python/arvados/keep.py @@ -371,6 +371,8 @@ class KeepClient(object): '{}: {}'.format(k,v) for k,v in self.get_headers.items()]) curl.setopt(pycurl.WRITEFUNCTION, response_body.write) curl.setopt(pycurl.HEADERFUNCTION, self._headerfunction) + if self.insecure: + curl.setopt(pycurl.SSL_VERIFYPEER, 0) if method == "HEAD": curl.setopt(pycurl.NOBODY, True) self._setcurltimeouts(curl, timeout) @@ -463,6 +465,8 @@ class KeepClient(object): '{}: {}'.format(k,v) for k,v in self.put_headers.items()]) curl.setopt(pycurl.WRITEFUNCTION, response_body.write) curl.setopt(pycurl.HEADERFUNCTION, self._headerfunction) + if self.insecure: + curl.setopt(pycurl.SSL_VERIFYPEER, 0) self._setcurltimeouts(curl, timeout) try: curl.perform() @@ -762,6 +766,11 @@ class KeepClient(object): if local_store is None: local_store = os.environ.get('KEEP_LOCAL_STORE') + if config.flag_is_true('ARVADOS_API_HOST_INSECURE'): + self.insecure = True + else: + self.insecure = False + self.block_cache = block_cache if block_cache else KeepBlockCache() self.timeout = timeout self.proxy_timeout = proxy_timeout