summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2018-01-15 15:25:35 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2018-01-15 15:25:35 +0000
commita159310c29636cd5f6b30e9c6303703c54d75595 (patch)
tree5d61a2ce8c59e1d8c55a6ad09d21a2063c0252f3
parent571406d44dd1aafa8f1518a14fc23e3f111145cd (diff)
downloadbuildstream-sam/improve-cache-warnings.tar.gz
Shorten the warnings raised when remote cache initialization failssam/improve-cache-warnings
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.py3
-rw-r--r--buildstream/_artifactcache/pushreceive.py4
-rw-r--r--buildstream/_pipeline.py2
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)