Skip to content
Snippets Groups Projects
Commit 1812262f authored by Daniel Silverstone's avatar Daniel Silverstone
Browse files

_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: default avatarDaniel Silverstone <daniel.silverstone@codethink.co.uk>
parent ae99dbca
No related branches found
No related tags found
No related merge requests found
Pipeline #34140151 failed
......@@ -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))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment