File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -2640,7 +2640,7 @@ def _prov_key_data(msg):
2640
2640
'package.\n '
2641
2641
'Check that the correct key URLs are configured for '
2642
2642
'this repository.' ) % repo .name
2643
- raise dnf .exceptions .Error (_prov_key_data (msg ))
2643
+ raise dnf .exceptions .InvalidInstalledGPGKeyError (_prov_key_data (msg ))
2644
2644
2645
2645
# Check if the newly installed keys helped
2646
2646
result , errmsg = self ._sig_check_pkg (po )
Original file line number Diff line number Diff line change @@ -284,6 +284,7 @@ def gpgsigcheck(self, pkgs):
284
284
:raises: Will raise :class:`Error` if there's a problem
285
285
"""
286
286
error_messages = []
287
+ print_plugin_recommendation = False
287
288
for po in pkgs :
288
289
result , errmsg = self ._sig_check_pkg (po )
289
290
@@ -304,6 +305,8 @@ def gpgsigcheck(self, pkgs):
304
305
self ._get_key_for_package (po , fn )
305
306
except (dnf .exceptions .Error , ValueError ) as e :
306
307
error_messages .append (str (e ))
308
+ if isinstance (e , dnf .exceptions .InvalidInstalledGPGKeyError ):
309
+ print_plugin_recommendation = True
307
310
308
311
else :
309
312
# Fatal error
@@ -312,8 +315,9 @@ def gpgsigcheck(self, pkgs):
312
315
if error_messages :
313
316
for msg in error_messages :
314
317
logger .critical (msg )
315
- logger .info ("\n Use the `--enableplugin=expired-pgp-keys' "
316
- "parameter to resolve the problem.\n " )
318
+ if print_plugin_recommendation :
319
+ msg = '\n ' + _ ("Try to add '--enableplugin=expired-pgp-keys' to resolve the problem." ) + '\n '
320
+ logger .info (msg )
317
321
raise dnf .exceptions .Error (_ ("GPG check FAILED" ))
318
322
319
323
def latest_changelogs (self , package ):
Original file line number Diff line number Diff line change @@ -86,6 +86,10 @@ def __str__(self):
86
86
return self .errmap2str (self .errmap )
87
87
88
88
89
+ class InvalidInstalledGPGKeyError (Error ):
90
+ pass
91
+
92
+
89
93
class LockError (Error ):
90
94
pass
91
95
You can’t perform that action at this time.
0 commit comments