Revision 6177890b
b/lib/watcher/__init__.py | ||
---|---|---|
329 | 329 |
Connects to RAPI port of hostname and does a simple test. At this time, the |
330 | 330 |
test is GetVersion. |
331 | 331 |
|
332 |
If RAPI responds with error code "401 Unauthorized", the test is successful, |
|
333 |
because the aim of this function is to assess whether RAPI is responding, not |
|
334 |
if it is accessible. |
|
335 |
|
|
332 | 336 |
@type hostname: string |
333 | 337 |
@param hostname: hostname of the node to connect to. |
334 | 338 |
@rtype: bool |
... | ... | |
344 | 348 |
logging.warning("RAPI certificate error: %s", err) |
345 | 349 |
return False |
346 | 350 |
except rapi.client.GanetiApiError, err: |
347 |
logging.warning("RAPI error: %s", err) |
|
348 |
return False |
|
351 |
if err.code == 401: |
|
352 |
# Unauthorized, but RAPI is alive and responding |
|
353 |
return True |
|
354 |
else: |
|
355 |
logging.warning("RAPI error: %s", err) |
|
356 |
return False |
|
349 | 357 |
else: |
350 | 358 |
logging.debug("Reported RAPI version %s", master_version) |
351 | 359 |
return master_version == constants.RAPI_VERSION |
Also available in: Unified diff