Blob Blame History Raw
From c4ee580c73375060b6eb5b3414636688e3d601c3 Mon Sep 17 00:00:00 2001
From: Marek Blaha <mblaha@redhat.com>
Date: Fri, 10 Jun 2022 15:29:56 +0200
Subject: [PATCH] Do not print errors on failovermethod repo option
 (RhBug:2039906)

= changelog =
msg:           Do not print errors if repository config contains failovermethod option
type:          bugfix
resolves:      https://bugzilla.redhat.com/show_bug.cgi?id=2039906
---
 libdnf/conf/ConfigRepo.cpp | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/libdnf/conf/ConfigRepo.cpp b/libdnf/conf/ConfigRepo.cpp
index e98ac0af..0cb52f58 100644
--- a/libdnf/conf/ConfigRepo.cpp
+++ b/libdnf/conf/ConfigRepo.cpp
@@ -22,6 +22,8 @@
 #include "Const.hpp"
 #include "Config-private.hpp"
 
+#include "bgettext/bgettext-lib.h"
+
 namespace libdnf {
 
 class ConfigRepo::Impl {
@@ -174,6 +176,14 @@ ConfigRepo::Impl::Impl(Config & owner, ConfigMain & mainConfig)
     owner.optBinds().add("enabled_metadata", enabled_metadata);
     owner.optBinds().add("user_agent", user_agent);
     owner.optBinds().add("countme", countme);
+    owner.optBinds().add("failovermethod", failovermethod,
+        [&](Option::Priority priority, const std::string & value){
+            if (value != "priority") {
+                throw Option::InvalidValue(_("only the value 'priority' is supported."));
+            }
+            failovermethod.set(priority, value);
+        }, nullptr, false
+    );
     owner.optBinds().add("sslverifystatus", sslverifystatus);
 }
 
-- 
2.36.1