richardphibel / rpms / libdnf

Forked from rpms/libdnf 2 years ago
Clone
Blob Blame History Raw
From 7e8a01dc9408cc48700f3d2a75cff67b3364d0c5 Mon Sep 17 00:00:00 2001
From: Jaroslav Mracek <jmracek@redhat.com>
Date: Wed, 20 Mar 2019 09:06:15 +0100
Subject: [PATCH] Add configuration option skip_if_unavailable (RhBug:1689931)

---
 libdnf/conf/ConfigMain.cpp | 3 +++
 libdnf/conf/ConfigMain.hpp | 1 +
 libdnf/conf/ConfigRepo.cpp | 4 ++--
 libdnf/conf/ConfigRepo.hpp | 2 +-
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/libdnf/conf/ConfigMain.cpp b/libdnf/conf/ConfigMain.cpp
index 2fc1f11..39cf8ab 100644
--- a/libdnf/conf/ConfigMain.cpp
+++ b/libdnf/conf/ConfigMain.cpp
@@ -333,6 +333,7 @@ class ConfigMain::Impl {
     OptionString sslclientkey{""};
     OptionBool deltarpm{true};
     OptionNumber<std::uint32_t> deltarpm_percentage{75};
+    OptionBool skip_if_unavailable{false};
 };
 
 ConfigMain::Impl::Impl(Config & owner)
@@ -469,6 +470,7 @@ ConfigMain::Impl::Impl(Config & owner)
     owner.optBinds().add("sslclientkey", sslclientkey);
     owner.optBinds().add("deltarpm", deltarpm);
     owner.optBinds().add("deltarpm_percentage", deltarpm_percentage);
+    owner.optBinds().add("skip_if_unavailable", skip_if_unavailable);
 }
 
 ConfigMain::ConfigMain() { pImpl = std::unique_ptr<Impl>(new Impl(*this)); }
@@ -572,5 +574,6 @@ OptionString & ConfigMain::sslclientcert() { return pImpl->sslclientcert; }
 OptionString & ConfigMain::sslclientkey() { return pImpl->sslclientkey; }
 OptionBool & ConfigMain::deltarpm() { return pImpl->deltarpm; }
 OptionNumber<std::uint32_t> & ConfigMain::deltarpm_percentage() { return pImpl->deltarpm_percentage; }
+OptionBool & ConfigMain::skip_if_unavailable() { return pImpl->skip_if_unavailable; }
 
 }
diff --git a/libdnf/conf/ConfigMain.hpp b/libdnf/conf/ConfigMain.hpp
index 331cdec..c2ead25 100644
--- a/libdnf/conf/ConfigMain.hpp
+++ b/libdnf/conf/ConfigMain.hpp
@@ -151,6 +151,7 @@ public:
     OptionString & sslclientkey();
     OptionBool & deltarpm();
     OptionNumber<std::uint32_t> & deltarpm_percentage();
+    OptionBool & skip_if_unavailable();
 
 private:
     class Impl;
diff --git a/libdnf/conf/ConfigRepo.cpp b/libdnf/conf/ConfigRepo.cpp
index 43fe56b..e86cdff 100644
--- a/libdnf/conf/ConfigRepo.cpp
+++ b/libdnf/conf/ConfigRepo.cpp
@@ -71,7 +71,7 @@ class ConfigRepo::Impl {
     OptionChild<OptionString> sslclientkey{masterConfig.sslclientkey()};
     OptionChild<OptionBool> deltarpm{masterConfig.deltarpm()};
     OptionChild<OptionNumber<std::uint32_t> > deltarpm_percentage{masterConfig.deltarpm_percentage()};
-    OptionBool skip_if_unavailable{false};
+    OptionChild<OptionBool> skip_if_unavailable{masterConfig.skip_if_unavailable()};
     OptionString enabled_metadata{""};
     OptionEnum<std::string> failovermethod{"priority", {"priority", "roundrobin"}};
 };
@@ -195,7 +195,7 @@ OptionChild<OptionString> & ConfigRepo::sslclientcert() { return pImpl->sslclien
 OptionChild<OptionString> & ConfigRepo::sslclientkey() { return pImpl->sslclientkey; }
 OptionChild<OptionBool> & ConfigRepo::deltarpm() { return pImpl->deltarpm; }
 OptionChild<OptionNumber<std::uint32_t> > & ConfigRepo::deltarpm_percentage() { return pImpl->deltarpm_percentage; }
-OptionBool & ConfigRepo::skip_if_unavailable() { return pImpl->skip_if_unavailable; }
+OptionChild<OptionBool> & ConfigRepo::skip_if_unavailable() { return pImpl->skip_if_unavailable; }
 OptionString & ConfigRepo::enabled_metadata() { return pImpl->enabled_metadata; }
 OptionEnum<std::string> & ConfigRepo::failovermethod() { return pImpl->failovermethod; }
 
diff --git a/libdnf/conf/ConfigRepo.hpp b/libdnf/conf/ConfigRepo.hpp
index c3e992b..a47030b 100644
--- a/libdnf/conf/ConfigRepo.hpp
+++ b/libdnf/conf/ConfigRepo.hpp
@@ -85,7 +85,7 @@ public:
     OptionChild<OptionString> & sslclientkey();
     OptionChild<OptionBool> & deltarpm();
     OptionChild<OptionNumber<std::uint32_t> > & deltarpm_percentage();
-    OptionBool & skip_if_unavailable();
+    OptionChild<OptionBool> & skip_if_unavailable();
     // option recognized by other tools, e.g. gnome-software, but unused in dnf
     OptionString & enabled_metadata();
     // yum compatibility options
--
libgit2 0.27.7