diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2018-01-15 15:25:35 +0000 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2018-01-16 08:24:26 +0100 |
commit | bc0f6cd53403bcf487b8fbc42905a33bac618e42 (patch) | |
tree | c2fd329bb6a157401c34e1e7f3c3aedaee26c31a | |
parent | fc48f087c918231bbad7f80206b1f85e7acf8d8a (diff) | |
download | buildstream-bc0f6cd53403bcf487b8fbc42905a33bac618e42.tar.gz |
Shorten the warnings raised when remote cache initialization fails
Before:
[--:--:--] WARNING Failed to fetch remote refs from ssh://ostree@ostree.baserock.org:22000/cache: BuildStream did not connect successfully to the shared cache ssh://ostree@ostree.baserock.org:22000/cache: SSH error: ssh: connect to host ostree.baserock.org port 22000: Connection refused
After:
[--:--:--] WARNING Failed to fetch remote refs from ssh://ostree@ostree.baserock.org:22000/cache. ssh: connect to host ostree.baserock.org port 22000: Connection refused
-rw-r--r-- | buildstream/_artifactcache/ostreecache.py | 3 | ||||
-rw-r--r-- | buildstream/_artifactcache/pushreceive.py | 4 | ||||
-rw-r--r-- | buildstream/_pipeline.py | 2 |
3 files changed, 4 insertions, 5 deletions
diff --git a/buildstream/_artifactcache/ostreecache.py b/buildstream/_artifactcache/ostreecache.py index ea93d228a..d0508bd93 100644 --- a/buildstream/_artifactcache/ostreecache.py +++ b/buildstream/_artifactcache/ostreecache.py @@ -327,8 +327,7 @@ class OSTreeCache(ArtifactCache): push_url = url pull_url = initialize_push_connection(url) except PushException as e: - raise ArtifactError("BuildStream did not connect successfully " - "to the shared cache {}: {}".format(url, e)) + raise ArtifactError(e) from e elif url.startswith('/'): push_url = pull_url = 'file://' + url elif url.startswith('file://'): diff --git a/buildstream/_artifactcache/pushreceive.py b/buildstream/_artifactcache/pushreceive.py index 9476c5c81..63adeb153 100644 --- a/buildstream/_artifactcache/pushreceive.py +++ b/buildstream/_artifactcache/pushreceive.py @@ -719,8 +719,8 @@ def initialize_push_connection(remote): # message that reader.receive_info() will have raised. ssh.wait() if ssh.returncode != 0: - ssh_error = ssh.stderr.read().decode('unicode-escape') - raise PushException("SSH error: {}".format(ssh_error)) + ssh_error = ssh.stderr.read().decode('unicode-escape').strip() + raise PushException("{}".format(ssh_error)) else: raise protocol_error diff --git a/buildstream/_pipeline.py b/buildstream/_pipeline.py index baea6c137..015918dc1 100644 --- a/buildstream/_pipeline.py +++ b/buildstream/_pipeline.py @@ -191,7 +191,7 @@ class Pipeline(): def initialize_remote_caches(self, artifact_cache_specs): def remote_failed(url, error): - self.message(MessageType.WARN, "Failed to fetch remote refs from {}: {}\n".format(url, error)) + self.message(MessageType.WARN, "Failed to fetch remote refs from {}: {}".format(url, error)) with self.timed_activity("Initializing remote caches", silent_nested=True): self.artifacts.set_remotes(artifact_cache_specs, on_failure=remote_failed) |