bitbake: cooker: Handle ImportError for websockets

Handles ImportError when creating a hash equivalence to ping the server.
This notifies user earlier with a more precise error if websockets can't
be used, and also prevents passing a known bad upstream value to the
local server

(Bitbake rev: 93190565fd1251e8f47d9a6291739f8b8ed5ec87)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit aa80b3cfc5d16dfba13ca7fb9b78bae179ce3b74)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
This commit is contained in:
joshua Watt 2024-05-02 12:35:01 -06:00 committed by Steve Sakoman
parent 68f9a4b73d
commit 107a6cec75

View File

@ -318,9 +318,10 @@ class BBCooker:
try:
with hashserv.create_client(upstream) as client:
client.ping()
except ConnectionError as e:
except (ConnectionError, ImportError) as e:
bb.warn("BB_HASHSERVE_UPSTREAM is not valid, unable to connect hash equivalence server at '%s': %s"
% (upstream, repr(e)))
upstream = None
self.hashservaddr = "unix://%s/hashserve.sock" % self.data.getVar("TOPDIR")
self.hashserv = hashserv.create_server(