[anaconda:rhel7/master] Catch and rethrow BTRFSValueError as KickstartException (#1019685)

mulhern amulhern at redhat.com
Thu Sep 11 17:34:49 UTC 2014


Related: rhbz#1019685

The BTRFS*Device constructors do some of their own checking for correct
values. It seems better to leverage that, than to duplicate those checks
in the kickstart code wherever possible.

Signed-off-by: mulhern <amulhern at redhat.com>
---
 pyanaconda/kickstart.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index df67743..3b9b904 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -32,6 +32,7 @@ import blivet.iscsi
 import blivet.fcoe
 import blivet.zfcp
 import blivet.arch
+import blivet.errors
 
 import glob
 from pyanaconda import iutil
@@ -454,12 +455,15 @@ class BTRFSData(commands.btrfs.F17_BTRFSData):
 
             device.format.mountpoint = self.mountpoint
         else:
-            request = storage.newBTRFS(name=name,
+            try:
+                request = storage.newBTRFS(name=name,
                                        subvol=self.subvol,
                                        mountpoint=self.mountpoint,
                                        metaDataLevel=self.metaDataLevel,
                                        dataLevel=self.dataLevel,
                                        parents=members)
+            except blivet.errors.BTRFSValueError as e:
+                raise KickstartValueError(formatErrorMsg(self.lineno, msg=e.message))
 
             storage.createDevice(request)
 
-- 
1.9.3



More information about the anaconda-patches mailing list