dnf/Fix-module-remove-all-when-no-match.patch

30 lines
1.2 KiB
Diff

From 7d10ddea6291399b3ed794c1d7fff326d2ec3e86 Mon Sep 17 00:00:00 2001
From: Jaroslav Mracek <jmracek@redhat.com>
Date: Tue, 8 Dec 2020 08:48:34 +0100
Subject: [PATCH] Fix module remove --all when no match spec (RhBug:1904490)
It resolves a traceback.
https://bugzilla.redhat.com/show_bug.cgi?id=1904490
Closes: #1699
Approved by: kontura
---
dnf/cli/commands/module.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/dnf/cli/commands/module.py b/dnf/cli/commands/module.py
index 4cdc915e21..0f584f9080 100644
--- a/dnf/cli/commands/module.py
+++ b/dnf/cli/commands/module.py
@@ -45,6 +45,9 @@ def _get_modules_from_name_stream_specs(self):
modules_from_specs = set()
for module_spec in self.opts.module_spec:
__, nsvcap = self.module_base._get_modules(module_spec)
+ # When there is no match, the problem was already reported by module_base.remove()
+ if nsvcap is None:
+ continue
name = nsvcap.name if nsvcap.name else ""
stream = nsvcap.stream if nsvcap.stream else ""
if (nsvcap.version and nsvcap.version != -1) or nsvcap.context: