summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2016-07-18 19:07:16 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-07-20 10:23:45 +0100
commit6597ba6b43fff2c8d8179090b4c92ce511c84a20 (patch)
treed8c68cbfd042c20747b81457393e513f9e4dafe8 /bitbake
parentdead7b22b4af5292c1a350ac09654b835f5aa4e5 (diff)
downloadpoky-6597ba6b43fff2c8d8179090b4c92ce511c84a20.tar.gz
bitbake: bitbake: xmlrpc: implement check of connection to server
Implemented check_connection function. The purpose of this function is to check if bitbake server is accessible and functional. To check this this function tries to connect to bitbake server and run getVariable command. This API is going to be used to implement autoloading of bitbake server. [YOCTO #5534] (Bitbake rev: 1a18f5ceb478f766b53850451549333f655621ea) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/server/xmlrpc.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/bitbake/lib/bb/server/xmlrpc.py b/bitbake/lib/bb/server/xmlrpc.py
index 57c59a82dd..4131b52679 100644
--- a/bitbake/lib/bb/server/xmlrpc.py
+++ b/bitbake/lib/bb/server/xmlrpc.py
@@ -85,6 +85,23 @@ def _create_server(host, port, timeout = 60):
85 s = xmlrpc.client.ServerProxy("http://%s:%d/" % (host, port), transport=t, allow_none=True, use_builtin_types=True) 85 s = xmlrpc.client.ServerProxy("http://%s:%d/" % (host, port), transport=t, allow_none=True, use_builtin_types=True)
86 return s, t 86 return s, t
87 87
88def check_connection(remote, timeout):
89 try:
90 host, port = remote.split(":")
91 port = int(port)
92 except Exception as e:
93 bb.warn("Failed to read remote definition (%s)" % str(e))
94 raise e
95
96 server, _transport = _create_server(host, port, timeout)
97 try:
98 ret, err = server.runCommand(['getVariable', 'TOPDIR'])
99 if err or not ret:
100 return False
101 except ConnectionError:
102 return False
103 return True
104
88class BitBakeServerCommands(): 105class BitBakeServerCommands():
89 106
90 def __init__(self, server): 107 def __init__(self, server):