From 8666b8ae06730d5706f35ae929e8e16536f352af Mon Sep 17 00:00:00 2001 From: Dominik Heidler Date: Tue, 12 Apr 2011 18:34:13 +0200 Subject: [PATCH] use old repo cache when refresh failed for non-root users (see bnc#683509) --- src/repos.cc | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/repos.cc b/src/repos.cc index 9bfcffe..0e9b5b1 100644 --- a/src/repos.cc +++ b/src/repos.cc @@ -3129,13 +3129,23 @@ void load_repo_resolvables(Zypper & zypper) if (error) { - ostringstream s; - s << format(_("Problem loading data from '%s'")) - % (zypper.config().show_alias ? repo.alias() : repo.name()) << endl; - s << format(_("Resolvables from '%s' not loaded because of error.")) - % (zypper.config().show_alias ? repo.alias() : repo.name()); - zypper.out().error(s.str()); - continue; + zypper.out().error(boost::str(format( + _("Problem loading data from '%s'")) + % (zypper.config().show_alias ? repo.alias() : repo.name()))); + + if (geteuid() != 0 && !zypper.globalOpts().changedRoot && manager.isCached(repo)) + { + zypper.out().warning(boost::str(format( + _("Repository '%s' could not be refreshed. Using old cache.")) + % (zypper.config().show_alias ? repo.alias() : repo.name()))); + } + else + { + zypper.out().error(boost::str(format( + _("Resolvables from '%s' not loaded because of error.")) + % (zypper.config().show_alias ? repo.alias() : repo.name()))); + continue; + } } manager.loadFromCache(repo); -- 2.7.4