richardphibel / rpms / libdnf

Forked from rpms/libdnf 2 years ago
Clone
2d633e
From c4ee580c73375060b6eb5b3414636688e3d601c3 Mon Sep 17 00:00:00 2001
2d633e
From: Marek Blaha <mblaha@redhat.com>
2d633e
Date: Fri, 10 Jun 2022 15:29:56 +0200
2d633e
Subject: [PATCH] Do not print errors on failovermethod repo option
2d633e
 (RhBug:2039906)
2d633e
2d633e
= changelog =
2d633e
msg:           Do not print errors if repository config contains failovermethod option
2d633e
type:          bugfix
2d633e
resolves:      https://bugzilla.redhat.com/show_bug.cgi?id=2039906
2d633e
---
2d633e
 libdnf/conf/ConfigRepo.cpp | 10 ++++++++++
2d633e
 1 file changed, 10 insertions(+)
2d633e
2d633e
diff --git a/libdnf/conf/ConfigRepo.cpp b/libdnf/conf/ConfigRepo.cpp
2d633e
index e98ac0af..0cb52f58 100644
2d633e
--- a/libdnf/conf/ConfigRepo.cpp
2d633e
+++ b/libdnf/conf/ConfigRepo.cpp
2d633e
@@ -22,6 +22,8 @@
2d633e
 #include "Const.hpp"
2d633e
 #include "Config-private.hpp"
2d633e
 
2d633e
+#include "bgettext/bgettext-lib.h"
2d633e
+
2d633e
 namespace libdnf {
2d633e
 
2d633e
 class ConfigRepo::Impl {
2d633e
@@ -174,6 +176,14 @@ ConfigRepo::Impl::Impl(Config & owner, ConfigMain & mainConfig)
2d633e
     owner.optBinds().add("enabled_metadata", enabled_metadata);
2d633e
     owner.optBinds().add("user_agent", user_agent);
2d633e
     owner.optBinds().add("countme", countme);
2d633e
+    owner.optBinds().add("failovermethod", failovermethod,
2d633e
+        [&](Option::Priority priority, const std::string & value){
2d633e
+            if (value != "priority") {
2d633e
+                throw Option::InvalidValue(_("only the value 'priority' is supported."));
2d633e
+            }
2d633e
+            failovermethod.set(priority, value);
2d633e
+        }, nullptr, false
2d633e
+    );
2d633e
     owner.optBinds().add("sslverifystatus", sslverifystatus);
2d633e
 }
2d633e
 
2d633e
-- 
2d633e
2.36.1
2d633e