diff options
author | Jim MacArthur <jim.macarthur@codethink.co.uk> | 2018-09-19 12:26:06 +0100 |
---|---|---|
committer | Jim MacArthur <jim.macarthur@codethink.co.uk> | 2018-09-21 11:53:11 +0100 |
commit | 2aae68c7c2d9f72b03328c4e42025001647782b5 (patch) | |
tree | ffe7df4c92c6525a12d5bdcf7d696436367f98d0 /buildstream/_artifactcache/cascache.py | |
parent | aa9caaac21cc5484792792615ba6ea4ac19a2f14 (diff) | |
download | buildstream-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
Diffstat (limited to 'buildstream/_artifactcache/cascache.py')
-rw-r--r-- | buildstream/_artifactcache/cascache.py | 16 |
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] |