[blivet:master 7/7] Be specific when catching exceptions

mulhern amulhern at redhat.com
Thu Mar 27 14:39:03 UTC 2014


From: David Shea <dshea at redhat.com>

Signed-off-by: mulhern <amulhern at redhat.com>
---
 blivet/__init__.py | 2 +-
 blivet/devices.py  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/blivet/__init__.py b/blivet/__init__.py
index dd4f487..2853dff 100644
--- a/blivet/__init__.py
+++ b/blivet/__init__.py
@@ -3034,7 +3034,7 @@ def getReleaseString():
 
     try:
         relArch = util.capture_output(["arch"], root=ROOT_PATH).strip()
-    except:
+    except OSError:
         relArch = None
 
     filename = "%s/etc/redhat-release" % ROOT_PATH
diff --git a/blivet/devices.py b/blivet/devices.py
index c0a6a62..5e9b0b7 100644
--- a/blivet/devices.py
+++ b/blivet/devices.py
@@ -4456,7 +4456,7 @@ class DASDDevice(DiskDevice):
                 feat, val = chunk.split('=')
                 if int(val):
                     opts.append(translate[feat])
-            except:
+            except (ValueError, KeyError):
                 # If we don't know what the feature is (feat not in translate
                 # or if we get a val that doesn't cleanly convert to an int
                 # we can't do anything with it.
-- 
1.8.3.1



More information about the anaconda-patches mailing list