 Chromium Code Reviews
 Chromium Code Reviews Issue 2976073002:
  Delay logging about missing certifi until it is really needed.  (Closed)
    
  
    Issue 2976073002:
  Delay logging about missing certifi until it is really needed.  (Closed) 
  | Index: client/isolate_storage.py | 
| diff --git a/client/isolate_storage.py b/client/isolate_storage.py | 
| index 8ce274f5892b1bd68901847720e5d5f7cf18b0e5..4bf40b6a437826a0d906569c251cc43dad69fc22 100644 | 
| --- a/client/isolate_storage.py | 
| +++ b/client/isolate_storage.py | 
| @@ -6,7 +6,6 @@ | 
| """A low-level blob storage/retrieval interface to the Isolate server""" | 
| import base64 | 
| -import binascii | 
| import collections | 
| import logging | 
| import os | 
| @@ -39,11 +38,12 @@ except ImportError as err: | 
| # actually used anywhere in this module, but if certifi is missing, | 
| # google.auth.transport will fail with | 
| # https://stackoverflow.com/questions/24973326 | 
| +certifi = None | 
| if grpc is not None: | 
| try: | 
| import certifi | 
| except ImportError as err: | 
| 
smut
2017/07/13 00:15:36
Unused variable "err".
 
Vadim Sh.
2017/07/13 00:18:03
Done.
 | 
| - logging.warning('could not import certifi; gRPC HTTPS connections may fail') | 
| + pass # could not import certifi; gRPC HTTPS connections may fail | 
| # Chunk size to use when reading from network stream. | 
| NET_IO_FILE_CHUNK = 16 * 1024 | 
| @@ -530,6 +530,9 @@ class IsolateServerGrpc(StorageApi): | 
| def __init__(self, server, namespace, proxy): | 
| super(IsolateServerGrpc, self).__init__() | 
| logging.info('Using gRPC for Isolate') | 
| + if not certifi: | 
| + logging.warning( | 
| + 'Could not import certifi; gRPC HTTPS connections may fail') | 
| self._server = server | 
| self._lock = threading.Lock() | 
| self._memory_use = 0 |