Skip to content

Commit 170581d

Browse files
pkratochrh-atomic-bot
authored andcommitted
Fix makecache error when no enabled repos (RhBug:1622090)
https://bugzilla.redhat.com/show_bug.cgi?id=1622090 Fixes issue with dnf-makecache.service failing. Closes: rpm-software-management#1183 Approved by: j-mracek
1 parent 3576792 commit 170581d

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

dnf/base.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,10 @@ def update_cache(self, timer=False):
388388
for repo in self.repos.values():
389389
repo._repo.setMaxMirrorTries(1)
390390

391+
if not self.repos._any_enabled():
392+
logger.info(_('There are no enabled repos.'))
393+
return False
394+
391395
for r in self.repos.iter_enabled():
392396
(is_cache, expires_in) = r._metadata_expire_in()
393397
if expires_in is None:

dnf/cli/commands/makecache.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,6 @@ def set_argparser(parser):
4343
parser.add_argument('timer', nargs='?', choices=['timer'],
4444
metavar='timer', help=argparse.SUPPRESS)
4545

46-
def configure(self):
47-
"""Verify that conditions are met so that this command can
48-
run; namely that there is an enabled repository.
49-
"""
50-
commands._checkEnabledRepo(self.base)
51-
5246
def run(self):
5347
timer = self.opts.timer is not None or self.opts.timer_opt
5448
msg = _("Making cache files for all metadata files.")

0 commit comments

Comments
 (0)