Revision 303bc802 lib/rapi/baserlib.py
b/lib/rapi/baserlib.py | ||
---|---|---|
34 | 34 |
from ganeti import http |
35 | 35 |
from ganeti import errors |
36 | 36 |
from ganeti import compat |
37 |
from ganeti import constants |
|
37 | 38 |
|
38 | 39 |
|
39 | 40 |
# Dummy value to detect unchanged parameters |
... | ... | |
382 | 383 |
""" |
383 | 384 |
return bool(self._checkIntVariable("dry-run")) |
384 | 385 |
|
385 |
def GetClient(self): |
|
386 |
def GetClient(self, query=False):
|
|
386 | 387 |
"""Wrapper for L{luxi.Client} with HTTP-specific error handling. |
387 | 388 |
|
389 |
@param query: this signifies that the client will only be used for |
|
390 |
queries; if the build-time parameter enable-split-queries is |
|
391 |
enabled, then the client will be connected to the query socket |
|
392 |
instead of the masterd socket |
|
393 |
|
|
388 | 394 |
""" |
395 |
if query and constants.ENABLE_SPLIT_QUERY: |
|
396 |
address = constants.QUERY_SOCKET |
|
397 |
else: |
|
398 |
address = None |
|
389 | 399 |
# Could be a function, pylint: disable=R0201 |
390 | 400 |
try: |
391 |
return self._client_cls() |
|
401 |
return self._client_cls(address=address)
|
|
392 | 402 |
except luxi.NoMasterError, err: |
393 | 403 |
raise http.HttpBadGateway("Can't connect to master daemon: %s" % err) |
394 | 404 |
except luxi.PermissionError: |
Also available in: Unified diff