From 521d4712ef531d13a68760bcd666f9056a14348e Mon Sep 17 00:00:00 2001 From: Konstantin Ryabitsev Date: Mon, 23 Nov 2020 15:56:45 -0500 Subject: Tweak display in softfail mode Don't display failures if there are no attestations available. Signed-off-by: Konstantin Ryabitsev --- b4/__init__.py | 12 ++++++------ 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 -- cgit v1.2.3