diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-11-23 15:56:45 -0500 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-11-23 15:56:45 -0500 |
commit | 521d4712ef531d13a68760bcd666f9056a14348e (patch) | |
tree | 1766e80e29069ee42b375695ebc07026d782025b | |
parent | 816375b5a8fb342324d3fd1cc6630f2fde7483da (diff) | |
download | b4-521d4712ef531d13a68760bcd666f9056a14348e.tar.gz |
Tweak display in softfail mode
Don't display failures if there are no attestations available.
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r-- | b4/__init__.py | 12 | ||||
-rw-r--r-- | b4/attest.py | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/b4/__init__.py b/b4/__init__.py index 2069e81..edd6c0c 100644 --- a/b4/__init__.py +++ b/b4/__init__.py @@ -537,20 +537,20 @@ class LoreSeries: logger.info(' %s %s', attpass, lmsg.full_subject) attdata[at-1] = (latt.lsig.attestor.get_trailer(lmsg.fromemail), attpass) # noqa else: - if attpolicy in ('softfail', 'hardfail'): + if latt and latt.lsig and attpolicy in ('softfail', 'hardfail'): logger.info(' %s %s', attfail, lmsg.full_subject) - failed = list() if latt and latt.lsig and latt.lsig.attestor and latt.lsig.attestor.mode == 'domain': - failed.append(latt.lsig.attestor.get_trailer()) - else: + atterrors.append('Failed %s attestation' % latt.lsig.attestor.get_trailer()) + elif latt and latt.lsig and latt.lsig.attestor: + failed = list() if not latt.pv: failed.append('patch content') if not latt.mv: failed.append('commit message') if not latt.iv: failed.append('patch metadata') - atterrors.append('Patch %s/%s failed attestation (%s)' % (at, lmsg.expected, - ', '.join(failed))) + atterrors.append('Patch %s/%s failed attestation (%s)' % (at, lmsg.expected, + ', '.join(failed))) else: logger.info(' %s', lmsg.full_subject) else: diff --git a/b4/attest.py b/b4/attest.py index e1a16f4..672b0e1 100644 --- a/b4/attest.py +++ b/b4/attest.py @@ -136,7 +136,7 @@ def mutt_filter() -> None: failed.append('commit message') if not latt.iv: failed.append('patch metadata') - latt.lsig.errors.add('signature failed (%s)' % ', '.join(failed)) + latt.lsig.errors.add('signature failed (%s)' % ', '.join(failed)) msg.add_header('Attestation-Failed', ', '.join(latt.lsig.errors)) # Delete the x-patch-hashes and x-patch-sig headers so # they don't boggle up the view |