From: "Brian C. Lane" <bcl(a)redhat.com>
Now that we're threaded things can get ugly. While examing the
filesystem things can vanish, causing an error. This ignores files that
go missing while getting the size of a directory.
---
pyanaconda/iutil.py | 34 ++++++++++++++++++++++++----------
1 file changed, 24 insertions(+), 10 deletions(-)
diff --git a/pyanaconda/iutil.py b/pyanaconda/iutil.py
index 9ac0da7..c86c63b 100644
--- a/pyanaconda/iutil.py
+++ b/pyanaconda/iutil.py
@@ -420,18 +420,34 @@ def execConsole():
except OSError as e:
raise RuntimeError, "Error running /bin/sh: " + e.strerror
-## Get the size of a directory and all its subdirectories.
-# @param dir The name of the directory to find the size of.
-# @return The size of the directory in kilobytes.
def getDirSize(dir):
+ """ Get the size of a directory and all its subdirectories.
+ @param dir The name of the directory to find the size of.
+ @return The size of the directory in kilobytes.
+ """
def getSubdirSize(dir):
- # returns size in bytes
- mydev = os.lstat(dir)[stat.ST_DEV]
+ # returns size in bytes
+ try:
+ mydev = os.lstat(dir)[stat.ST_DEV]
+ except OSError as e:
+ log.debug("failed to stat %s: %s" % (dir, e))
+ return 0
+
+ try:
+ dirlist = os.listdir(dir)
+ except OSError as e:
+ log.debug("failed to listdir %s: %s" % (dir, e))
+ return 0
dsize = 0
- for f in os.listdir(dir):
- curpath = '%s/%s' % (dir, f)
- sinfo = os.lstat(curpath)
+ for f in dirlist:
+ curpath = '%s/%s' % (dir, f)
+ try:
+ sinfo = os.lstat(curpath)
+ except OSError as e:
+ log.debug("failed to stat %s/%s: %s" % (dir, f, e))
+ continue
+
if stat.S_ISDIR(sinfo[stat.ST_MODE]):
if os.path.ismount(curpath):
continue
@@ -439,8 +455,6 @@ def getDirSize(dir):
dsize += getSubdirSize(curpath)
elif stat.S_ISREG(sinfo[stat.ST_MODE]):
dsize += sinfo[stat.ST_SIZE]
- else:
- pass
return dsize
return getSubdirSize(dir)/1024
--
1.8.0.2
Show replies by date
From: "Brian C. Lane" <bcl(a)redhat.com>
We always want to show the welcome screen for interactive installs. For
kickstart, only show it if there isn't a language setup.
---
pyanaconda/ui/gui/spokes/welcome.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pyanaconda/ui/gui/spokes/welcome.py b/pyanaconda/ui/gui/spokes/welcome.py
index f335c14..a3a33a6 100644
--- a/pyanaconda/ui/gui/spokes/welcome.py
+++ b/pyanaconda/ui/gui/spokes/welcome.py
@@ -122,7 +122,7 @@ class LanguageMixIn(object):
if flags.flags.automatedInstall:
return self.data.lang.lang and self.data.lang.lang != ""
else:
- return self.data.lang.lang and self.data.lang.lang != "" and
isFinal
+ return False
def initialize(self):
store = self.builder.get_object("languageStore")
--
1.8.0.2