summaryrefslogtreecommitdiff
path: root/buildstream/_artifactcache/cascache.py
diff options
context:
space:
mode:
Diffstat (limited to 'buildstream/_artifactcache/cascache.py')
-rw-r--r--buildstream/_artifactcache/cascache.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/buildstream/_artifactcache/cascache.py b/buildstream/_artifactcache/cascache.py
index 56c70ba9b..936cb780b 100644
--- a/buildstream/_artifactcache/cascache.py
+++ b/buildstream/_artifactcache/cascache.py
@@ -54,7 +54,6 @@ _MAX_PAYLOAD_BYTES = 1024 * 1024
#
# Args:
# context (Context): The BuildStream context
-# enable_push (bool): Whether pushing is allowed by the platform
#
# Pushing is explicitly disabled by the platform in some cases,
# like when we are falling back to functioning without using
@@ -62,7 +61,7 @@ _MAX_PAYLOAD_BYTES = 1024 * 1024
#
class CASCache(ArtifactCache):
- def __init__(self, context, *, enable_push=True):
+ def __init__(self, context):
super().__init__(context)
self.casdir = os.path.join(context.artifactdir, 'cas')
@@ -71,8 +70,6 @@ class CASCache(ArtifactCache):
self._calculate_cache_quota()
- self._enable_push = enable_push
-
# Per-project list of _CASRemote instances.
self._remotes = {}
@@ -83,6 +80,12 @@ class CASCache(ArtifactCache):
# Implementation of abstract methods #
################################################
+ def preflight(self):
+ if (not os.path.isdir(os.path.join(self.casdir, 'refs', 'heads')) or
+ not os.path.isdir(os.path.join(self.casdir, 'objects'))):
+ raise ArtifactError("CAS repository check failed for '{}'"
+ .format(self.casdir))
+
def contains(self, element, key):
refpath = self._refpath(self.get_artifact_fullname(element, key))
@@ -214,7 +217,7 @@ class CASCache(ArtifactCache):
return bool(remotes_for_project)
def has_push_remotes(self, *, element=None):
- if not self._has_push_remotes or not self._enable_push:
+ if not self._has_push_remotes:
# No project has push remotes
return False
elif element is None: