Bug 524454
Summary: | yum repolist accesses all repos | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Mads Kiilerich <mads> |
Component: | yum | Assignee: | Seth Vidal <skvidal> |
Status: | CLOSED RAWHIDE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | medium | Docs Contact: | |
Priority: | low | ||
Version: | rawhide | CC: | ffesti, james.antill, maxamillion, pmatilai, tim.lauridsen |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2009-09-25 03:56:47 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Mads Kiilerich
2009-09-20 12:51:00 UTC
Proposed fix for upstream: Catch and ignore any repo. errors, and allow cache only (BZ 524454) diff --git a/yumcommands.py b/yumcommands.py index bd73d0c..3d88ee4 100644 --- a/yumcommands.py +++ b/yumcommands.py @@ -778,13 +778,17 @@ class RepoListCommand(YumCommand): arg = 'enabled' extcmds = map(lambda x: x.lower(), extcmds) - # Setup so len(repo.sack) is correct - base.repos.populateSack() + verbose = base.verbose_logger.isEnabledFor(logginglevels.DEBUG_3) + try: + # Setup so len(repo.sack) is correct + base.repos.populateSack() + except yum.Errors.RepoError: + if verbose: + raise repos = base.repos.repos.values() repos.sort() enabled_repos = base.repos.listEnabled() - verbose = base.verbose_logger.isEnabledFor(logginglevels.DEBUG_3) if arg == 'all': ehibeg = base.term.FG_COLOR['green'] + base.term.MODE['bold'] dhibeg = base.term.FG_COLOR['red'] ...this means that "yum repolist -C all" will now always work (without hitting the network). I am not familiar with the yum codebase, but at a first glance it seems like this patch "just" would make it acceptable that contacting the repos failed unless verbose. In my specific case where yum hang while trying to contact a repo that isn't good enough. And AFAICS a plain repolist without verbose doesn't use anything from the server anyway, so why contact them at all? This patch to yum-3.2.24-4.fc12.noarch seems to give the behaviour I would like: --- /usr/share/yum-cli/yumcommands.py- 2009-09-21 23:02:01.000000000 +0200 +++ /usr/share/yum-cli/yumcommands.py 2009-09-21 23:02:48.000000000 +0200 @@ -778,13 +778,14 @@ arg = 'enabled' extcmds = map(lambda x: x.lower(), extcmds) - # Setup so len(repo.sack) is correct - base.repos.populateSack() + verbose = base.verbose_logger.isEnabledFor(logginglevels.DEBUG_3) + if verbose: + # Setup so len(repo.sack) is correct + base.repos.populateSack() repos = base.repos.repos.values() repos.sort() enabled_repos = base.repos.listEnabled() - verbose = base.verbose_logger.isEnabledFor(logginglevels.DEBUG_3) if arg == 'all': ehibeg = base.term.FG_COLOR['green'] + base.term.MODE['bold'] dhibeg = base.term.FG_COLOR['red'] As I said in my last comment: this means that "yum repolist -C all" will now always work (without hitting the network). ...feel free to use an alias or whatever if you always want that behaviour. Upstream commit is now in as: http://yum.baseurl.org/gitweb?p=yum.git;a=commitdiff;h=2ffe59eb3e441f3fce3038d1c19079cc5c59eb74 ...but I think new F11 packages should be in updates-testing "soon", if you don't want to apply it by hand it. Yes, I saw that -C worked without hitting the network. That is fine and definitely an improvement. It did however not cross my mind to try to use -C, so it wouldn't have helped _me_ in that situation. My point is that there is _no_ need for repolist without -C and without -v to hit the network. For that reason I think it would be nice if it didn't do that. I assume that you got my point but disagree and say that the rule is that yum without -C hits the network and yum with -C doesn't and you don't want execptions. Ok. You write the code and you decide ;-) > My point is that there is _no_ need for repolist without -C and without -v to > hit the network. It hits the network so it can get the package counts, I guess there are cases where this might not be that useful but there are some where it's very useful. > say that the rule is that yum without -C hits the network The rule is only that yum without -C _can_ hit the network, but we try not to if there's no reason to (for instance "yum remove" doesn't). At the same time we don't try to optimize for broken repos. ... so you'd have to have a pretty good argument for removing the package counts. Anyway, a yum with the fix is in rawhide now. You are right. Package count is a reason to always try to connect. I hadn't noticed the package counts in the output. yum-3.2.24-2.fc11 has been pushed to the Fedora 11 stable repository. If problems still persist, please make note of it in this bug report. yum-3.2.24-2.fc10 has been submitted as an update for Fedora 10. http://admin.fedoraproject.org/updates/yum-3.2.24-2.fc10 yum-3.2.24-2.fc10 has been pushed to the Fedora 10 stable repository. If problems still persist, please make note of it in this bug report. |