mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-26 11:30:23 +00:00
Fix affluent communication
Affluent would hang on error, particularly certificate problem. Fix by catching and being explicit about the error, and generically fixing the arguments for 'get' to have the inntended timeout.
This commit is contained in:
parent
e08ca5fb7e
commit
3469c8ab2b
@ -36,7 +36,14 @@ class WebClient(object):
|
||||
self.wc.set_basic_credentials(creds[node]['secret.hardwaremanagementuser']['value'], creds[node]['secret.hardwaremanagementpassword']['value'])
|
||||
|
||||
def fetch(self, url, results):
|
||||
rsp, status = self.wc.grab_json_response_with_status(url)
|
||||
try:
|
||||
rsp, status = self.wc.grab_json_response_with_status(url)
|
||||
except exc.PubkeyInvalid:
|
||||
results.put(msg.ConfluentNodeError(self.node,
|
||||
'Extended information unavailable, mismatch detected between '
|
||||
'target certificate fingerprint and '
|
||||
'pubkeys.tls_hardwaremanager attribute'))
|
||||
return {}
|
||||
if status == 401:
|
||||
results.put(msg.ConfluentTargetInvalidCredentials(self.node, 'Unable to authenticate'))
|
||||
return {}
|
||||
@ -91,7 +98,7 @@ def retrieve(nodes, element, configmanager, inputdata):
|
||||
return
|
||||
while workers:
|
||||
try:
|
||||
datum = results.get(10)
|
||||
datum = results.get(block=True, timeout=10)
|
||||
while datum:
|
||||
if datum:
|
||||
yield datum
|
||||
|
Loading…
Reference in New Issue
Block a user