2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 09:32:21 +00:00

Provide graceful error message on cert mismatch

Firmware update can provide a more clean looking message on the
event of a cert mismatch.  Improve polish by doing it this way.
This commit is contained in:
Jarrod Johnson 2017-10-18 12:58:21 -04:00
parent 3e93cb2434
commit 6659b31106
2 changed files with 6 additions and 0 deletions

View File

@ -100,6 +100,7 @@ class PubkeyInvalid(ConfluentException):
def __init__(self, text, certificate, fingerprint, attribname, event):
super(PubkeyInvalid, self).__init__(self, text)
self.fingerprint = fingerprint
self.attrname = attribname
bodydata = {'message': text,
'event': event,
'fingerprint': fingerprint,

View File

@ -31,6 +31,11 @@ def execupdate(handler, filename, updateobj):
if completion is None:
completion = 'complete'
updateobj.handle_progress({'phase': completion, 'progress': 100.0})
except exc.PubkeyInvalid as pi:
errstr = 'Certificate mismatch detected, does not match value in ' \
'attribute {0}'.format(pi.attrname)
updateobj.handle_progress({'phase': 'error', 'progress': 0.0,
'detail': errstr})
except Exception as e:
updateobj.handle_progress({'phase': 'error', 'progress': 0.0,
'detail': str(e)})