aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorjoshua Watt <JPEWhacker@gmail.com>2024-05-02 08:18:30 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-05-02 16:07:09 +0100
commit5e84c13a6c594ed34c341849806657ddda206714 (patch)
tree5492641cfb70e53ed014c0f94b80551764d7ed15 /lib
parent97ffe14311407f6e705ec24b70870ab32f0637b9 (diff)
downloadbitbake-5e84c13a6c594ed34c341849806657ddda206714.tar.gz
cooker: Use hash client to ping upstream server
The cooker attempts to connect to the upstream hash equivalent server to warn the user early if it is misconfigured. However, this was making the assumption that it was a raw TCP connection and failed when attempting to use a websocket upstream server. Fix this by creating an hash client and using the ping API to check the server instead of using a raw socket. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/bb/cooker.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index c5bfef55d..25b614f1e 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -315,11 +315,10 @@ class BBCooker:
dbfile = (self.data.getVar("PERSISTENT_DIR") or self.data.getVar("CACHE")) + "/hashserv.db"
upstream = self.data.getVar("BB_HASHSERVE_UPSTREAM") or None
if upstream:
- import socket
try:
- sock = socket.create_connection(upstream.split(":"), 5)
- sock.close()
- except socket.error as e:
+ with hashserv.create_client(upstream) as client:
+ client.ping()
+ except ConnectionError as e:
bb.warn("BB_HASHSERVE_UPSTREAM is not valid, unable to connect hash equivalence server at '%s': %s"
% (upstream, repr(e)))