diff options
Diffstat (limited to 'buildstream/_artifactcache/ostreecache.py')
-rw-r--r-- | buildstream/_artifactcache/ostreecache.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/buildstream/_artifactcache/ostreecache.py b/buildstream/_artifactcache/ostreecache.py index 079cf95cf..85ad3a4cf 100644 --- a/buildstream/_artifactcache/ostreecache.py +++ b/buildstream/_artifactcache/ostreecache.py @@ -53,11 +53,19 @@ def buildref(element, key): # Args: # context (Context): The BuildStream context # project (Project): The BuildStream project +# enable_push (bool): Whether pushing is allowed +# +# Pushing is explicitly disabled by the platform in some cases, +# like when we are falling back to functioning without using +# user namespaces. # class OSTreeCache(ArtifactCache): - def __init__(self, context, project): + + def __init__(self, context, project, enable_push): super().__init__(context, project) + self.enable_push = enable_push + ostreedir = os.path.join(context.artifactdir, 'ostree') self.repo = _ostree.ensure(ostreedir, False) @@ -66,6 +74,11 @@ class OSTreeCache(ArtifactCache): self._remote_refs = None + def can_push(self): + if self.enable_push: + return super().can_push() + return False + def preflight(self): if self.can_push() and not self.artifact_push.startswith("/"): try: |