--- iw/release_notes.py | 9 ++++++++- urlinstall.py | 12 +++++++----- 2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/iw/release_notes.py b/iw/release_notes.py index ca7d87c..38b5bbc 100644 --- a/iw/release_notes.py +++ b/iw/release_notes.py @@ -26,6 +26,9 @@ import gui
from rhpl.translate import _, N_
+import logging +log = logging.getLogger("anaconda") + class ReleaseNotesViewer: def __init__(self, anaconda): self.currentURI = None @@ -62,7 +65,10 @@ class ReleaseNotesViewer: for suffix in suffixList: fn = "RELEASE-NOTES%s" % (suffix,) try: - tmpfile = os.path.abspath(self.anaconda.dispatch.method.getFilename(fn, destdir="/tmp", retry=0)) + tmpfile = os.path.abspath( + self.anaconda.dispatch.method.getFilename( + fn, destdir="/tmp", retry=0, + loglevel=logging.INFO)) if tmpfile is None: continue
@@ -79,6 +85,7 @@ class ReleaseNotesViewer: except: continue
+ log.error("getReleaseNotes() failed.") return None
def resize(self, w=None, h=None): diff --git a/urlinstall.py b/urlinstall.py index d0b1e00..4c0f6da 100644 --- a/urlinstall.py +++ b/urlinstall.py @@ -117,7 +117,8 @@ class UrlInstallMethod(InstallMethod): isys.makeDevInode("loop0", "/tmp/loop") isys.lochangefd("/tmp/loop", self.loopbackFile)
- def getFilename(self, filename, callback=None, destdir=None, retry=1): + def getFilename(self, filename, callback=None, destdir=None, retry=1, + loglevel=logging.CRITICAL):
if destdir is None: tmppath = self.getTempPath() @@ -125,7 +126,7 @@ class UrlInstallMethod(InstallMethod): tmppath = destdir
base = self.pkgUrl - + fullPath = base + "/" + filename
file = tmppath + "/" + os.path.basename(fullPath) @@ -135,12 +136,13 @@ class UrlInstallMethod(InstallMethod): try: rc=urlretrieve(fullPath, file, callback=callback) except IOError, (errnum, msg): - log.critical("IOError %s occurred getting %s: %s" - %(errnum, fullPath.replace("%", "%%"), str(msg))) + if loglevel: + log.log(loglevel, "Problem (%s) occurred getting %s: %s" + %(errnum, fullPath.replace("%", "%%"), str(msg)))
if not retry: raise FileCopyException - + time.sleep(5) else: break
Looks good.
-- Martin Sivák msivak@redhat.com Red Hat Czech Anaconda team / Brno, CZ
----- Original Message -----
iw/release_notes.py | 9 ++++++++- urlinstall.py | 12 +++++++----- 2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/iw/release_notes.py b/iw/release_notes.py index ca7d87c..38b5bbc 100644 --- a/iw/release_notes.py +++ b/iw/release_notes.py @@ -26,6 +26,9 @@ import gui
from rhpl.translate import _, N_
+import logging +log = logging.getLogger("anaconda")
class ReleaseNotesViewer: def __init__(self, anaconda): self.currentURI = None @@ -62,7 +65,10 @@ class ReleaseNotesViewer: for suffix in suffixList: fn = "RELEASE-NOTES%s" % (suffix,) try:
- tmpfile =
os.path.abspath(self.anaconda.dispatch.method.getFilename(fn, destdir="/tmp", retry=0))
- tmpfile = os.path.abspath(
- self.anaconda.dispatch.method.getFilename(
- fn, destdir="/tmp", retry=0,
- loglevel=logging.INFO))
if tmpfile is None: continue
@@ -79,6 +85,7 @@ class ReleaseNotesViewer: except: continue
- log.error("getReleaseNotes() failed.")
return None
def resize(self, w=None, h=None): diff --git a/urlinstall.py b/urlinstall.py index d0b1e00..4c0f6da 100644 --- a/urlinstall.py +++ b/urlinstall.py @@ -117,7 +117,8 @@ class UrlInstallMethod(InstallMethod): isys.makeDevInode("loop0", "/tmp/loop") isys.lochangefd("/tmp/loop", self.loopbackFile)
- def getFilename(self, filename, callback=None, destdir=None,
retry=1):
- def getFilename(self, filename, callback=None, destdir=None,
retry=1,
- loglevel=logging.CRITICAL):
if destdir is None: tmppath = self.getTempPath() @@ -125,7 +126,7 @@ class UrlInstallMethod(InstallMethod): tmppath = destdir
base = self.pkgUrl
fullPath = base + "/" + filename
file = tmppath + "/" + os.path.basename(fullPath) @@ -135,12 +136,13 @@ class UrlInstallMethod(InstallMethod): try: rc=urlretrieve(fullPath, file, callback=callback) except IOError, (errnum, msg):
- log.critical("IOError %s occurred getting %s: %s"
- %(errnum, fullPath.replace("%", "%%"), str(msg)))
- if loglevel:
- log.log(loglevel, "Problem (%s) occurred getting %s: %s"
- %(errnum, fullPath.replace("%", "%%"), str(msg)))
if not retry: raise FileCopyException
time.sleep(5) else: break -- 1.7.6
Anaconda-devel-list mailing list Anaconda-devel-list@redhat.com https://www.redhat.com/mailman/listinfo/anaconda-devel-list
anaconda-devel@lists.stg.fedoraproject.org