diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2014-06-11 10:19:03 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-06-13 11:55:33 +0100 |
commit | 74cd8c38aa434ab825931f30b957d7b4bf871a9a (patch) | |
tree | 83eb7e68f84eaded742b6d2bc9073e095b62e139 /bitbake/lib/bb/server | |
parent | c7ae6bd30751a3020077b395dba929846dd1e020 (diff) | |
download | poky-74cd8c38aa434ab825931f30b957d7b4bf871a9a.tar.gz |
bitbake: xmlrpc: add support for token reusing
We add support to specify a connection token in the command line
and in the environment variable BBTOKEN.
When a client registers to a bitbake server, that client
will have exclusive access to the server. The client is identified
by a server-supplied token. If a client terminates, we cannot
reconnect to the server as the token is lost.
This patch adds the capability to specify the connection token
in the command line for xmlrpc clients. This allows us
to have bitbake work as an already-authenticated
client with the server and resume sending commands to a server.
(Bitbake rev: db5390940c0afbcdc9fbcf1225761968ae51d4a7)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/server')
-rw-r--r-- | bitbake/lib/bb/server/xmlrpc.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/bitbake/lib/bb/server/xmlrpc.py b/bitbake/lib/bb/server/xmlrpc.py index d6f4338ae5..4205a4c35f 100644 --- a/bitbake/lib/bb/server/xmlrpc.py +++ b/bitbake/lib/bb/server/xmlrpc.py | |||
@@ -281,13 +281,16 @@ class BitBakeXMLRPCServerConnection(BitBakeBaseServerConnection): | |||
281 | self.observer_only = observer_only | 281 | self.observer_only = observer_only |
282 | self.featureset = featureset | 282 | self.featureset = featureset |
283 | 283 | ||
284 | def connect(self): | 284 | def connect(self, token = None): |
285 | if not self.observer_only: | 285 | if token is None: |
286 | token = self.connection.addClient() | 286 | if self.observer_only: |
287 | else: | 287 | token = "observer" |
288 | token = "observer" | 288 | else: |
289 | token = self.connection.addClient() | ||
290 | |||
289 | if token is None: | 291 | if token is None: |
290 | return None | 292 | return None |
293 | |||
291 | self.transport.set_connection_token(token) | 294 | self.transport.set_connection_token(token) |
292 | 295 | ||
293 | self.events = uievent.BBUIEventQueue(self.connection, self.clientinfo) | 296 | self.events = uievent.BBUIEventQueue(self.connection, self.clientinfo) |
@@ -336,7 +339,9 @@ class BitBakeServer(BitBakeBaseServer): | |||
336 | 339 | ||
337 | class BitBakeXMLRPCClient(BitBakeBaseServer): | 340 | class BitBakeXMLRPCClient(BitBakeBaseServer): |
338 | 341 | ||
339 | def __init__(self, observer_only = False): | 342 | def __init__(self, observer_only = False, token = None): |
343 | self.token = token | ||
344 | |||
340 | self.observer_only = observer_only | 345 | self.observer_only = observer_only |
341 | # if we need extra caches, just tell the server to load them all | 346 | # if we need extra caches, just tell the server to load them all |
342 | pass | 347 | pass |
@@ -366,7 +371,7 @@ class BitBakeXMLRPCClient(BitBakeBaseServer): | |||
366 | try: | 371 | try: |
367 | self.serverImpl = XMLRPCProxyServer(host, port) | 372 | self.serverImpl = XMLRPCProxyServer(host, port) |
368 | self.connection = BitBakeXMLRPCServerConnection(self.serverImpl, (ip, 0), self.observer_only, featureset) | 373 | self.connection = BitBakeXMLRPCServerConnection(self.serverImpl, (ip, 0), self.observer_only, featureset) |
369 | return self.connection.connect() | 374 | return self.connection.connect(self.token) |
370 | except Exception as e: | 375 | except Exception as e: |
371 | bb.warn("Could not connect to server at %s:%s (%s)" % (host, port, str(e))) | 376 | bb.warn("Could not connect to server at %s:%s (%s)" % (host, port, str(e))) |
372 | raise e | 377 | raise e |