summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim MacArthur <jim.macarthur@codethink.co.uk>2018-09-19 12:26:06 +0100
committerJim MacArthur <jim.macarthur@codethink.co.uk>2018-09-21 11:53:11 +0100
commit2aae68c7c2d9f72b03328c4e42025001647782b5 (patch)
treeffe7df4c92c6525a12d5bdcf7d696436367f98d0
parentaa9caaac21cc5484792792615ba6ea4ac19a2f14 (diff)
downloadbuildstream-2aae68c7c2d9f72b03328c4e42025001647782b5.tar.gz
cascache.py: make push_remote raise exception if no push remotes exist
Also add docstring to method and remove return value since it was useless
-rw-r--r--buildstream/_artifactcache/cascache.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/buildstream/_artifactcache/cascache.py b/buildstream/_artifactcache/cascache.py
index 840e190f1..50f74a927 100644
--- a/buildstream/_artifactcache/cascache.py
+++ b/buildstream/_artifactcache/cascache.py
@@ -348,19 +348,29 @@ class CASCache(ArtifactCache):
return pushed
def push_directory(self, project, directory):
+ """ Push the given virtual directory to all remotes.
+
+ Args:
+ project (Project): The current project
+ directory (Directory): A virtual directory object to push.
+
+ Raises: ArtifactError if no push remotes are configured.
+ """
push_remotes = [r for r in self._remotes[project] if r.spec.push]
+ if not push_remotes:
+ raise ArtifactError("CASCache: push_directory was called, but no remote artifact " +
+ "servers are configured as push remotes.")
+
if directory.ref is None:
- return None
+ return
for remote in push_remotes:
remote.init()
self._send_directory(remote, directory.ref)
- return directory.ref
-
def push_message(self, project, message):
push_remotes = [r for r in self._remotes[project] if r.spec.push]