Blob Blame History Raw
From 9ceb74f77479910f7844a9a87d4b7623687076be Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Fri, 24 Jul 2020 07:59:38 +0200
Subject: [PATCH] Allow stream switching if option enabled

= changelog =
msg: New config option module_allow_stream_switch allows switching enabled streams
type: enhancement
---
 dnf.spec       |  2 +-
 dnf/cli/cli.py | 19 ++++++++++---------
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/dnf.spec b/dnf.spec
index 0e63b2b422..04f6f104c7 100644
--- a/dnf.spec
+++ b/dnf.spec
@@ -2,7 +2,7 @@
 %undefine __cmake_in_source_build
 
 # default dependencies
-%global hawkey_version 0.54.4
+%global hawkey_version 0.55.0
 %global libcomps_version 0.1.8
 %global libmodulemd_version 1.4.0
 %global rpm_version 4.14.0
diff --git a/dnf/cli/cli.py b/dnf/cli/cli.py
index be737ed3b7..29d7373fa3 100644
--- a/dnf/cli/cli.py
+++ b/dnf/cli/cli.py
@@ -166,15 +166,16 @@ def do_transaction(self, display=()):
         :return: history database transaction ID or None
         """
         if dnf.base.WITH_MODULES:
-            switchedModules = dict(self._moduleContainer.getSwitchedStreams())
-            if switchedModules:
-                report_module_switch(switchedModules)
-                msg = _("It is not possible to switch enabled streams of a module.\n"
-                        "It is recommended to remove all installed content from the module, and "
-                        "reset the module using '{prog} module reset <module_name>' command. After "
-                        "you reset the module, you can install the other stream.").format(
-                    prog=dnf.util.MAIN_PROG)
-                raise dnf.exceptions.Error(msg)
+            if not self.conf.module_stream_switch:
+                switchedModules = dict(self._moduleContainer.getSwitchedStreams())
+                if switchedModules:
+                    report_module_switch(switchedModules)
+                    msg = _("It is not possible to switch enabled streams of a module.\n"
+                            "It is recommended to remove all installed content from the module, and "
+                            "reset the module using '{prog} module reset <module_name>' command. After "
+                            "you reset the module, you can install the other stream.").format(
+                        prog=dnf.util.MAIN_PROG)
+                    raise dnf.exceptions.Error(msg)
 
         trans = self.transaction
         pkg_str = self.output.list_transaction(trans)