diff options
author | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2018-10-24 11:28:43 +0100 |
---|---|---|
committer | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2018-10-25 15:43:52 +0100 |
commit | 1445a901fcf4a91ef867183e4685b526aad916a6 (patch) | |
tree | 495280ce21abd850c5b94edf15cfb82b00338ad0 /buildstream/_artifactcache | |
parent | ad8271f0add42e089f19a7b055a0edfcdd903c03 (diff) | |
download | buildstream-1445a901fcf4a91ef867183e4685b526aad916a6.tar.gz |
_artifactcache/cascache.py: Cleanup lint warning about indexing
In order to quieten the linter, and to make a more correct comparison,
we switch to using the `Code.OK` enumeration from `google.rpc.Code`
Signed-off-by: Daniel Silverstone <daniel.silverstone@codethink.co.uk>
Diffstat (limited to 'buildstream/_artifactcache')
-rw-r--r-- | buildstream/_artifactcache/cascache.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/buildstream/_artifactcache/cascache.py b/buildstream/_artifactcache/cascache.py index a9473646d..b99f4d7b8 100644 --- a/buildstream/_artifactcache/cascache.py +++ b/buildstream/_artifactcache/cascache.py @@ -33,6 +33,7 @@ import grpc from .. import _yaml +from .._protos.google.rpc import code_pb2 from .._protos.google.bytestream import bytestream_pb2, bytestream_pb2_grpc from .._protos.build.bazel.remote.execution.v2 import remote_execution_pb2, remote_execution_pb2_grpc from .._protos.buildstream.v2 import buildstream_pb2, buildstream_pb2_grpc @@ -1201,7 +1202,7 @@ class _CASBatchRead(): batch_response = self._remote.cas.BatchReadBlobs(self._request) for response in batch_response.responses: - if response.status.code != grpc.StatusCode.OK.value[0]: + if response.status.code != code_pb2.OK: raise ArtifactError("Failed to download blob {}: {}".format( response.digest.hash, response.status.code)) if response.digest.size_bytes != len(response.data): @@ -1246,7 +1247,7 @@ class _CASBatchUpdate(): batch_response = self._remote.cas.BatchUpdateBlobs(self._request) for response in batch_response.responses: - if response.status.code != grpc.StatusCode.OK.value[0]: + if response.status.code != code_pb2.OK: raise ArtifactError("Failed to upload blob {}: {}".format( response.digest.hash, response.status.code)) |