diff options
author | Konrad Scherer <Konrad.Scherer@windriver.com> | 2014-09-24 09:06:42 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-09-29 12:08:48 +0100 |
commit | e92e8009a1589d1e049eb7b34038d644ec872b82 (patch) | |
tree | 75d0f2e32af8cd23c82d4aeaee1c3c505b81b8a9 | |
parent | 438a50844285238934f9d49e72362e19281e95c8 (diff) | |
download | poky-e92e8009a1589d1e049eb7b34038d644ec872b82.tar.gz |
bitbake: prserv/serv: Improve error message when prserver cannot bind to supplied host address
If localhost resolves to a remote address (due to a misconfigured network),
starting the pr server will fail without useful information.
To reproduce, add '<bogus ip> localhost' to /etc/hosts and run
'bitbake -p'. The error message will be:
ERROR: Timeout while attempting to communicate with bitbake server
ERROR: Could not connect to server False:
Running 'bitbake-prserv --host=localhost --port=0 --start' will fail with:
error: [Errno 99] Cannot assign requested address
Since these errors does not show the IP address of the attempted socket
binding, this results in a lot of wasted time looking at firewall rules, etc.
This patch results in the following error message if the socket binding fails:
PR Server unable to bind to <bogus ip>:0
(Bitbake rev: fae5914030bcf4c061c22fc61034c40c87b7121a)
Signed-off-by: Konrad Scherer <Konrad.Scherer@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/prserv/serv.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/bitbake/lib/prserv/serv.py b/bitbake/lib/prserv/serv.py index 1e170cea0a..1b08d59130 100644 --- a/bitbake/lib/prserv/serv.py +++ b/bitbake/lib/prserv/serv.py | |||
@@ -38,8 +38,17 @@ singleton = None | |||
38 | class PRServer(SimpleXMLRPCServer): | 38 | class PRServer(SimpleXMLRPCServer): |
39 | def __init__(self, dbfile, logfile, interface, daemon=True): | 39 | def __init__(self, dbfile, logfile, interface, daemon=True): |
40 | ''' constructor ''' | 40 | ''' constructor ''' |
41 | SimpleXMLRPCServer.__init__(self, interface, | 41 | import socket |
42 | logRequests=False, allow_none=True) | 42 | try: |
43 | SimpleXMLRPCServer.__init__(self, interface, | ||
44 | logRequests=False, allow_none=True) | ||
45 | except socket.error: | ||
46 | ip=socket.gethostbyname(interface[0]) | ||
47 | port=interface[1] | ||
48 | msg="PR Server unable to bind to %s:%s\n" % (ip, port) | ||
49 | sys.stderr.write(msg) | ||
50 | raise PRServiceConfigError | ||
51 | |||
43 | self.dbfile=dbfile | 52 | self.dbfile=dbfile |
44 | self.daemon=daemon | 53 | self.daemon=daemon |
45 | self.logfile=logfile | 54 | self.logfile=logfile |