summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/buildstream/_artifactcache.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/buildstream/_artifactcache.py b/src/buildstream/_artifactcache.py
index 4a502064f..d62e7f500 100644
--- a/src/buildstream/_artifactcache.py
+++ b/src/buildstream/_artifactcache.py
@@ -23,7 +23,8 @@ import grpc
from ._basecache import BaseCache
from .types import _KeyStrength
from ._exceptions import ArtifactError, CASError, CASCacheError
-from ._protos.buildstream.v2 import artifact_pb2, artifact_pb2_grpc
+from ._protos.buildstream.v2 import buildstream_pb2, buildstream_pb2_grpc, \
+ artifact_pb2, artifact_pb2_grpc
from ._cas import CASRemoteSpec, CASRemote
from .storage._casbaseddirectory import CasBasedDirectory
@@ -48,7 +49,7 @@ class ArtifactCacheSpec(CASRemoteSpec):
class ArtifactRemote(CASRemote):
def __init__(self, *args):
super().__init__(*args)
- self.artifact_service = None
+ self.capabilities_service = None
def init(self):
if not self._initialized:
@@ -56,24 +57,28 @@ class ArtifactRemote(CASRemote):
super().init()
# Add artifact stub
- self.artifact_service = artifact_pb2_grpc.ArtifactServiceStub(self.channel)
+ self.capabilities_service = buildstream_pb2_grpc.CapabilitiesStub(self.channel)
# Check whether the server supports newer proto based artifact.
try:
- request = artifact_pb2.ArtifactStatusRequest()
+ request = buildstream_pb2.GetCapabilitiesRequest()
if self.instance_name:
request.instance_name = self.instance_name
- self.artifact_service.ArtifactStatus(request)
+ response = self.capabilities_service.GetCapabilities(request)
except grpc.RpcError as e:
# Check if this remote has the artifact service
if e.code() == grpc.StatusCode.UNIMPLEMENTED:
raise ArtifactError(
"Configured remote does not have the BuildStream "
- "ArtifactService. Please check remote configuration.")
+ "capabilities service. Please check remote configuration.")
# Else raise exception with details
raise ArtifactError(
"Remote initialisation failed: {}".format(e.details()))
+ if not response.artifact_capabilities:
+ raise ArtifactError(
+ "Configured remote does not support artifact service")
+
# An ArtifactCache manages artifacts.
#