From adba30551f317092dc775a5a74ebf816e7f03e82 Mon Sep 17 00:00:00 2001 From: Till Maas Date: Fri, 19 Aug 2011 20:07:27 +0200 Subject: Add proper error message for bodhi cache file Do not show a backtrace when the bodhi cache file cannot be accessed, but a proper error message instead. Red Hat bug report: https://bugzilla.redhat.com/show_bug.cgi?id=718446 --- fedora-easy-karma.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/fedora-easy-karma.py b/fedora-easy-karma.py index a0fa84c..64045fe 100755 --- a/fedora-easy-karma.py +++ b/fedora-easy-karma.py @@ -294,9 +294,13 @@ class FedoraEasyKarma(object): cachefile_name = os.path.join(self.options.bodhi_cachedir, "bodhi-cache-%s.cpickle" % release) if self.options.bodhi_cached: self.debug("reading bodhi cache") - cachefile = open(cachefile_name, "rb") - testing_updates = pickle.load(cachefile) - cachefile.close() + try: + cachefile = open(cachefile_name, "rb") + testing_updates = pickle.load(cachefile) + cachefile.close() + except IOError, ioe: + print "Cannot access bodhi cache file: %s" % cachefile_name + sys.exit(ioe.errno) else: self.info("Getting list of packages in updates-testing...") self.debug("starting bodhi query") -- cgit