filbranden / rpms / dnf

Forked from rpms/dnf 4 years ago
Clone

Blame SOURCES/0001-Allow-to-set-cacheonly-from-commands-and-conf-RhBug-.patch

72d647
From bc11bf599ce3102656fa42b0ad0a6c7270822f30 Mon Sep 17 00:00:00 2001
72d647
From: Jaroslav Mracek <jmracek@redhat.com>
72d647
Date: Mon, 27 Nov 2017 14:35:32 +0100
72d647
Subject: [PATCH 1/3] Allow to set cacheonly from commands and conf
72d647
 (RhBug:1492036)
72d647
72d647
The formal code reacts only to --cacheonly option.
72d647
72d647
https://bugzilla.redhat.com/show_bug.cgi?id=1492036
72d647
---
72d647
 dnf/cli/cli.py | 5 ++++-
72d647
 1 file changed, 4 insertions(+), 1 deletion(-)
72d647
72d647
diff --git a/dnf/cli/cli.py b/dnf/cli/cli.py
72d647
index f60cdced..11fbed31 100644
72d647
--- a/dnf/cli/cli.py
72d647
+++ b/dnf/cli/cli.py
72d647
@@ -741,7 +741,10 @@ class Cli(object):
72d647
             if not os.getegid() == 0:
72d647
                 raise dnf.exceptions.Error(_('This command has to be run under the root user.'))
72d647
 
72d647
-        if not demands.cacheonly:
72d647
+        if demands.cacheonly or self.base.conf.cacheonly:
72d647
+            self.base.conf.cacheonly = True
72d647
+            repos.all()._md_only_cached = True
72d647
+        else:
72d647
             if demands.freshest_metadata:
72d647
                 for repo in repos.iter_enabled():
72d647
                     repo._md_expire_cache()
72d647
-- 
72d647
2.13.6
72d647