Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Unified Diff: client/isolate_storage.py

Issue 2976073002: Delay logging about missing certifi until it is really needed. (Closed)
Patch Set: nits, more comments Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/isolate_storage.py
diff --git a/client/isolate_storage.py b/client/isolate_storage.py
index 8ce274f5892b1bd68901847720e5d5f7cf18b0e5..a158bbf3a3e5c5dc69e2ce70102abe944760cf6d 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,15 @@ 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:
- logging.warning('could not import certifi; gRPC HTTPS connections may fail')
+ except ImportError:
+ # Could not import certifi; gRPC HTTPS connections may fail. This will be
+ # logged in IsolateServerGrpc.__init__, since the logger is not configured
+ # during the import time.
+ pass
# Chunk size to use when reading from network stream.
NET_IO_FILE_CHUNK = 16 * 1024
@@ -530,6 +533,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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698