diff options
-rwxr-xr-x | bitbake/bin/bitbake | 8 | ||||
-rw-r--r-- | bitbake/lib/bb/server/xmlrpc.py | 19 |
2 files changed, 19 insertions, 8 deletions
diff --git a/bitbake/bin/bitbake b/bitbake/bin/bitbake index f120baccf0..b3acbe1bd2 100755 --- a/bitbake/bin/bitbake +++ b/bitbake/bin/bitbake | |||
@@ -169,6 +169,9 @@ class BitBakeConfigParameters(cookerdata.ConfigParameters): | |||
169 | parser.add_option("-t", "--servertype", help = "Choose which server to use, process or xmlrpc.", | 169 | parser.add_option("-t", "--servertype", help = "Choose which server to use, process or xmlrpc.", |
170 | action = "store", dest = "servertype") | 170 | action = "store", dest = "servertype") |
171 | 171 | ||
172 | parser.add_option("", "--token", help = "Specify the connection token to be used when connecting to a remote server.", | ||
173 | action = "store", dest = "xmlrpctoken") | ||
174 | |||
172 | parser.add_option("", "--revisions-changed", help = "Set the exit code depending on whether upstream floating revisions have changed or not.", | 175 | parser.add_option("", "--revisions-changed", help = "Set the exit code depending on whether upstream floating revisions have changed or not.", |
173 | action = "store_true", dest = "revisions_changed", default = False) | 176 | action = "store_true", dest = "revisions_changed", default = False) |
174 | 177 | ||
@@ -200,6 +203,9 @@ class BitBakeConfigParameters(cookerdata.ConfigParameters): | |||
200 | options.servertype = "xmlrpc" | 203 | options.servertype = "xmlrpc" |
201 | options.remote_server = os.environ["BBSERVER"] | 204 | options.remote_server = os.environ["BBSERVER"] |
202 | 205 | ||
206 | if "BBTOKEN" in os.environ: | ||
207 | options.xmlrpctoken = os.environ["BBTOKEN"] | ||
208 | |||
203 | # if BBSERVER says to autodetect, let's do that | 209 | # if BBSERVER says to autodetect, let's do that |
204 | if options.remote_server: | 210 | if options.remote_server: |
205 | [host, port] = options.remote_server.split(":", 2) | 211 | [host, port] = options.remote_server.split(":", 2) |
@@ -332,7 +338,7 @@ def main(): | |||
332 | bb.event.ui_queue = [] | 338 | bb.event.ui_queue = [] |
333 | else: | 339 | else: |
334 | # we start a stub server that is actually a XMLRPClient that connects to a real server | 340 | # we start a stub server that is actually a XMLRPClient that connects to a real server |
335 | server = servermodule.BitBakeXMLRPCClient(configParams.observe_only) | 341 | server = servermodule.BitBakeXMLRPCClient(configParams.observe_only, configParams.xmlrpctoken) |
336 | server.saveConnectionDetails(configParams.remote_server) | 342 | server.saveConnectionDetails(configParams.remote_server) |
337 | 343 | ||
338 | 344 | ||
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 |