[PATCH 2/5] Use "raise Exception()" instead of "raise Exception, ..."

Chris Lumens clumens at redhat.com
Tue Aug 20 18:42:11 UTC 2013


---
 pyanaconda/__init__.py              |   2 +-
 pyanaconda/desktop.py               |   2 +-
 pyanaconda/flags.py                 |   2 +-
 pyanaconda/installclass.py          |   2 +-
 pyanaconda/iutil.py                 |   2 +-
 pyanaconda/kickstart.py             | 101 ++++++++++++++++++------------------
 pyanaconda/ui/gui/spokes/network.py |   8 +--
 7 files changed, 59 insertions(+), 60 deletions(-)

diff --git a/pyanaconda/__init__.py b/pyanaconda/__init__.py
index 9102d17..ec24053 100644
--- a/pyanaconda/__init__.py
+++ b/pyanaconda/__init__.py
@@ -188,7 +188,7 @@ class Anaconda(object):
 
     def initInterface(self, addon_paths=None):
         if self._intf:
-            raise RuntimeError, "Second attempt to initialize the InstallInterface"
+            raise RuntimeError("Second attempt to initialize the InstallInterface")
 
         if self.displayMode == 'g':
             from pyanaconda.ui.gui import GraphicalUserInterface
diff --git a/pyanaconda/desktop.py b/pyanaconda/desktop.py
index 7a919d5..eaf73c5 100644
--- a/pyanaconda/desktop.py
+++ b/pyanaconda/desktop.py
@@ -33,7 +33,7 @@ class Desktop(SimpleConfigFile):
 #
     def setDefaultRunLevel(self, runlevel):
         if int(runlevel) not in RUNLEVELS:
-            raise RuntimeError, "Desktop::setDefaultRunLevel() - Must specify runlevel as 3 or 5!"
+            raise RuntimeError("Desktop::setDefaultRunLevel() - Must specify runlevel as 3 or 5!")
         self.runlevel = runlevel
 
     def getDefaultRunLevel(self):
diff --git a/pyanaconda/flags.py b/pyanaconda/flags.py
index 3c21de3..3775678 100644
--- a/pyanaconda/flags.py
+++ b/pyanaconda/flags.py
@@ -31,7 +31,7 @@ class Flags(object):
     def __setattr__(self, attr, val):
         # pylint: disable-msg=E1101
         if attr not in self.__dict__ and not self._in_init:
-            raise AttributeError, attr
+            raise AttributeError(attr)
         else:
             self.__dict__[attr] = val
 
diff --git a/pyanaconda/installclass.py b/pyanaconda/installclass.py
index 00572b7..b1a26ac 100644
--- a/pyanaconda/installclass.py
+++ b/pyanaconda/installclass.py
@@ -232,7 +232,7 @@ def getBaseInstallClass():
 
     # Default to the base installclass if nothing else is found.
     else:
-        raise RuntimeError, "Unable to find an install class to use!!!"
+        raise RuntimeError("Unable to find an install class to use!!!")
 
     return cobject
 
diff --git a/pyanaconda/iutil.py b/pyanaconda/iutil.py
index f42789b..7b162df 100644
--- a/pyanaconda/iutil.py
+++ b/pyanaconda/iutil.py
@@ -200,7 +200,7 @@ def execConsole():
         proc = subprocess.Popen(["/bin/sh"])
         proc.wait()
     except OSError as e:
-        raise RuntimeError, "Error running /bin/sh: " + e.strerror
+        raise RuntimeError("Error running /bin/sh: " + e.strerror)
 
 def getDirSize(directory):
     """ Get the size of a directory and all its subdirectories.
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index 081b4cb..51bbe14 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -284,8 +284,8 @@ class Bootloader(commands.bootloader.F19_Bootloader):
 
         if self.bootDrive:
             if not self.bootDrive in disk_names:
-                raise KickstartValueError, formatErrorMsg(self.lineno,
-                        msg="Requested boot drive %s doesn't exist" % self.bootDrive)
+                raise KickstartValueError(formatErrorMsg(self.lineno,
+                        msg="Requested boot drive %s doesn't exist" % self.bootDrive))
         else:
             self.bootDrive = disk_names[0]
 
@@ -324,7 +324,7 @@ class BTRFSData(commands.btrfs.F17_BTRFSData):
                 except IndexError:
                     dev = None
             if not dev:
-                raise KickstartValueError, formatErrorMsg(self.lineno, msg="Tried to use undefined partition %s in BTRFS volume specification" % member)
+                raise KickstartValueError(formatErrorMsg(self.lineno, msg="Tried to use undefined partition %s in BTRFS volume specification" % member))
 
             members.append(dev)
 
@@ -336,7 +336,7 @@ class BTRFSData(commands.btrfs.F17_BTRFSData):
             name = None
 
         if len(members) == 0 and not self.preexist:
-            raise KickstartValueError, formatErrorMsg(self.lineno, msg="BTRFS volume defined without any member devices.  Either specify member devices or use --useexisting.")
+            raise KickstartValueError(formatErrorMsg(self.lineno, msg="BTRFS volume defined without any member devices.  Either specify member devices or use --useexisting."))
 
         # allow creating btrfs vols/subvols without specifying mountpoint
         if self.mountpoint in ("none", "None"):
@@ -344,7 +344,7 @@ class BTRFSData(commands.btrfs.F17_BTRFSData):
 
         # Sanity check mountpoint
         if self.mountpoint != "" and self.mountpoint[0] != '/':
-            raise KickstartValueError, formatErrorMsg(self.lineno, msg="The mount point \"%s\" is not valid." % (self.mountpoint,))
+            raise KickstartValueError(formatErrorMsg(self.lineno, msg="The mount point \"%s\" is not valid." % (self.mountpoint,)))
 
         if self.preexist:
             device = devicetree.getDeviceByName(self.name)
@@ -352,7 +352,7 @@ class BTRFSData(commands.btrfs.F17_BTRFSData):
                 device = udev.udev_resolve_devspec(self.name)
 
             if not device:
-                raise KickstartValueError, formatErrorMsg(self.lineno, msg="Specified nonexistent BTRFS volume %s in btrfs command" % self.name)
+                raise KickstartValueError(formatErrorMsg(self.lineno, msg="Specified nonexistent BTRFS volume %s in btrfs command" % self.name))
         else:
             # If a previous device has claimed this mount point, delete the
             # old one.
@@ -462,7 +462,7 @@ class ClearPart(commands.clearpart.F17_ClearPart):
             if matched:
                 drives.extend(matched)
             else:
-                raise KickstartValueError, formatErrorMsg(self.lineno, msg="Specified nonexistent disk %s in clearpart command" % spec)
+                raise KickstartValueError(formatErrorMsg(self.lineno, msg="Specified nonexistent disk %s in clearpart command" % spec))
 
         self.drives = drives
 
@@ -474,7 +474,7 @@ class ClearPart(commands.clearpart.F17_ClearPart):
             if matched:
                 devices.extend(matched)
             else:
-                raise KickstartValueError, formatErrorMsg(self.lineno, msg="Specified nonexistent device %s in clearpart device list" % spec)
+                raise KickstartValueError(formatErrorMsg(self.lineno, msg="Specified nonexistent device %s in clearpart device list" % spec))
 
         self.devices = devices
 
@@ -495,7 +495,7 @@ class Fcoe(commands.fcoe.F13_Fcoe):
         fc = commands.fcoe.F13_Fcoe.parse(self, args)
 
         if fc.nic not in nm.nm_devices():
-            raise KickstartValueError, formatErrorMsg(self.lineno, msg="Specified nonexistent nic %s in fcoe command" % fc.nic)
+            raise KickstartValueError(formatErrorMsg(self.lineno, msg="Specified nonexistent nic %s in fcoe command" % fc.nic))
 
         blivet.fcoe.fcoe().addSan(nic=fc.nic, dcb=fc.dcb, auto_vlan=True)
 
@@ -563,7 +563,7 @@ class IgnoreDisk(commands.ignoredisk.RHEL6_IgnoreDisk):
             if matched:
                 drives.extend(matched)
             else:
-                raise KickstartValueError, formatErrorMsg(self.lineno, msg="Specified nonexistent disk %s in ignoredisk command" % spec)
+                raise KickstartValueError(formatErrorMsg(self.lineno, msg="Specified nonexistent disk %s in ignoredisk command" % spec))
 
         self.ignoredisk = drives
 
@@ -573,7 +573,7 @@ class IgnoreDisk(commands.ignoredisk.RHEL6_IgnoreDisk):
             if matched:
                 drives.extend(matched)
             else:
-                raise KickstartValueError, formatErrorMsg(self.lineno, msg="Specified nonexistent disk %s in ignoredisk command" % spec)
+                raise KickstartValueError(formatErrorMsg(self.lineno, msg="Specified nonexistent disk %s in ignoredisk command" % spec))
 
         self.onlyuse = drives
 
@@ -585,7 +585,7 @@ class Iscsi(commands.iscsi.F17_Iscsi):
 
         if tg.iface:
             if not network.wait_for_network_devices([tg.iface]):
-                raise KickstartValueError, formatErrorMsg(self.lineno, msg="network interface %s required by iscsi %s target is not up" % (tg.iface, tg.target))
+                raise KickstartValueError(formatErrorMsg(self.lineno, msg="network interface %s required by iscsi %s target is not up" % (tg.iface, tg.target)))
 
         mode = blivet.iscsi.iscsi().mode
         if mode == "none":
@@ -593,7 +593,7 @@ class Iscsi(commands.iscsi.F17_Iscsi):
                 blivet.iscsi.iscsi().create_interfaces(nm.nm_activated_devices())
         elif ((mode == "bind" and not tg.iface)
               or (mode == "default" and tg.iface)):
-            raise KickstartValueError, formatErrorMsg(self.lineno, msg="iscsi --iface must be specified (binding used) either for all targets or for none")
+            raise KickstartValueError(formatErrorMsg(self.lineno, msg="iscsi --iface must be specified (binding used) either for all targets or for none"))
 
         try:
             blivet.iscsi.iscsi().addTarget(tg.ipaddr, tg.port, tg.user,
@@ -605,8 +605,7 @@ class Iscsi(commands.iscsi.F17_Iscsi):
                                                             tg.ipaddr,
                                                             tg.iface))
         except (IOError, ValueError) as e:
-            raise KickstartValueError, formatErrorMsg(self.lineno,
-                                                      msg=str(e))
+            raise KickstartValueError(formatErrorMsg(self.lineno, msg=str(e)))
 
         return tg
 
@@ -661,12 +660,12 @@ class LogVolData(commands.logvol.F20_LogVolData):
 
         # Sanity check mountpoint
         if self.mountpoint != "" and self.mountpoint[0] != '/':
-            raise KickstartValueError, formatErrorMsg(self.lineno, msg="The mount point \"%s\" is not valid." % (self.mountpoint,))
+            raise KickstartValueError(formatErrorMsg(self.lineno, msg="The mount point \"%s\" is not valid." % (self.mountpoint,)))
 
         # Check that the VG this LV is a member of has already been specified.
         vg = devicetree.getDeviceByName(vgname)
         if not vg:
-            raise KickstartValueError, formatErrorMsg(self.lineno, msg="No volume group exists with the name \"%s\".  Specify volume groups before logical volumes." % self.vgname)
+            raise KickstartValueError(formatErrorMsg(self.lineno, msg="No volume group exists with the name \"%s\".  Specify volume groups before logical volumes." % self.vgname))
 
         pool = None
         if self.thin_volume:
@@ -682,11 +681,11 @@ class LogVolData(commands.logvol.F20_LogVolData):
         # quit here after setting up enough information to mount it later.
         if not self.format:
             if not self.name:
-                raise KickstartValueError, formatErrorMsg(self.lineno, msg="--noformat used without --name")
+                raise KickstartValueError(formatErrorMsg(self.lineno, msg="--noformat used without --name"))
 
             dev = devicetree.getDeviceByName("%s-%s" % (vg.name, self.name))
             if not dev:
-                raise KickstartValueError, formatErrorMsg(self.lineno, msg="No preexisting logical volume with the name \"%s\" was found." % self.name)
+                raise KickstartValueError(formatErrorMsg(self.lineno, msg="No preexisting logical volume with the name \"%s\" was found." % self.name))
 
             if self.resize:
                 if self.size < dev.currentSize:
@@ -714,16 +713,16 @@ class LogVolData(commands.logvol.F20_LogVolData):
         if not self.preexist:
             tmp = devicetree.getDeviceByName("%s-%s" % (vg.name, self.name))
             if tmp:
-                raise KickstartValueError, formatErrorMsg(self.lineno, msg="Logical volume name already used in volume group %s" % vg.name)
+                raise KickstartValueError(formatErrorMsg(self.lineno, msg="Logical volume name already used in volume group %s" % vg.name))
 
             # Size specification checks
             if not self.percent:
                 if not self.size:
-                    raise KickstartValueError, formatErrorMsg(self.lineno, msg="Size required")
+                    raise KickstartValueError(formatErrorMsg(self.lineno, msg="Size required"))
                 elif not self.grow and self.size*1024 < vg.peSize:
-                    raise KickstartValueError, formatErrorMsg(self.lineno, msg="Logical volume size must be larger than the volume group physical extent size.")
+                    raise KickstartValueError(formatErrorMsg(self.lineno, msg="Logical volume size must be larger than the volume group physical extent size."))
             elif self.percent <= 0 or self.percent > 100:
-                raise KickstartValueError, formatErrorMsg(self.lineno, msg="Percentage must be between 0 and 100")
+                raise KickstartValueError(formatErrorMsg(self.lineno, msg="Percentage must be between 0 and 100"))
 
         # Now get a format to hold a lot of these extra values.
         fmt = getFormat(ty,
@@ -732,7 +731,7 @@ class LogVolData(commands.logvol.F20_LogVolData):
                         fsprofile=self.fsprofile,
                         mountopts=self.fsopts)
         if not fmt.type and not self.thin_pool:
-            raise KickstartValueError, formatErrorMsg(self.lineno, msg="The \"%s\" filesystem type is not supported." % ty)
+            raise KickstartValueError(formatErrorMsg(self.lineno, msg="The \"%s\" filesystem type is not supported." % ty))
 
         # If we were given a pre-existing LV to create a filesystem on, we need
         # to verify it and its VG exists and then schedule a new format action
@@ -741,7 +740,7 @@ class LogVolData(commands.logvol.F20_LogVolData):
         if self.preexist:
             device = devicetree.getDeviceByName("%s-%s" % (vg.name, self.name))
             if not device:
-                raise KickstartValueError, formatErrorMsg(self.lineno, msg="Specified nonexistent LV %s in logvol command" % self.name)
+                raise KickstartValueError(formatErrorMsg(self.lineno, msg="Specified nonexistent LV %s in logvol command" % self.name))
 
             removeExistingFormat(device, storage)
 
@@ -862,7 +861,7 @@ class PartitionData(commands.partition.F18_PartData):
                     break
 
             if not self.disk:
-                raise KickstartValueError, formatErrorMsg(self.lineno, msg="Specified BIOS disk %s cannot be determined" % self.onbiosdisk)
+                raise KickstartValueError(formatErrorMsg(self.lineno, msg="Specified BIOS disk %s cannot be determined" % self.onbiosdisk))
 
         if self.mountpoint == "swap":
             ty = "swap"
@@ -893,7 +892,7 @@ class PartitionData(commands.partition.F18_PartData):
             self.mountpoint = ""
 
             if devicetree.getDeviceByName(kwargs["name"]):
-                raise KickstartValueError, formatErrorMsg(self.lineno, msg="RAID partition defined multiple times")
+                raise KickstartValueError(formatErrorMsg(self.lineno, msg="RAID partition defined multiple times"))
 
             if self.onPart:
                 ksdata.onPart[kwargs["name"]] = self.onPart
@@ -903,7 +902,7 @@ class PartitionData(commands.partition.F18_PartData):
             self.mountpoint = ""
 
             if devicetree.getDeviceByName(kwargs["name"]):
-                raise KickstartValueError, formatErrorMsg(self.lineno, msg="PV partition defined multiple times")
+                raise KickstartValueError(formatErrorMsg(self.lineno, msg="PV partition defined multiple times"))
 
             if self.onPart:
                 ksdata.onPart[kwargs["name"]] = self.onPart
@@ -913,7 +912,7 @@ class PartitionData(commands.partition.F18_PartData):
             self.mountpoint = ""
 
             if devicetree.getDeviceByName(kwargs["name"]):
-                raise KickstartValueError, formatErrorMsg(self.lineno, msg="BTRFS partition defined multiple times")
+                raise KickstartValueError(formatErrorMsg(self.lineno, msg="BTRFS partition defined multiple times"))
 
             if self.onPart:
                 ksdata.onPart[kwargs["name"]] = self.onPart
@@ -935,11 +934,11 @@ class PartitionData(commands.partition.F18_PartData):
         # quit here after setting up enough information to mount it later.
         if not self.format:
             if not self.onPart:
-                raise KickstartValueError, formatErrorMsg(self.lineno, msg="--noformat used without --onpart")
+                raise KickstartValueError(formatErrorMsg(self.lineno, msg="--noformat used without --onpart"))
 
             dev = devicetree.getDeviceByName(udev.udev_resolve_devspec(self.onPart))
             if not dev:
-                raise KickstartValueError, formatErrorMsg(self.lineno, msg="No preexisting partition with the name \"%s\" was found." % self.onPart)
+                raise KickstartValueError(formatErrorMsg(self.lineno, msg="No preexisting partition with the name \"%s\" was found." % self.onPart))
 
             if self.resize:
                 if self.size < dev.currentSize:
@@ -970,7 +969,7 @@ class PartitionData(commands.partition.F18_PartData):
                                      fsprofile=self.fsprofile,
                                      mountopts=self.fsopts)
         if not kwargs["format"].type:
-            raise KickstartValueError, formatErrorMsg(self.lineno, msg="The \"%s\" filesystem type is not supported." % ty)
+            raise KickstartValueError(formatErrorMsg(self.lineno, msg="The \"%s\" filesystem type is not supported." % ty))
 
         # If we were given a specific disk to create the partition on, verify
         # that it exists first.  If it doesn't exist, see if it exists with
@@ -986,19 +985,19 @@ class PartitionData(commands.partition.F18_PartData):
                                      % (disk.name, mpath_device.name))
                     disk = mpath_device
                 if not disk:
-                    raise KickstartValueError, formatErrorMsg(self.lineno, msg="Specified nonexistent disk %s in partition command" % n)
+                    raise KickstartValueError(formatErrorMsg(self.lineno, msg="Specified nonexistent disk %s in partition command" % n))
                 if not disk.partitionable:
-                    raise KickstartValueError, formatErrorMsg(self.lineno, msg="Cannot install to read-only media %s." % n)
+                    raise KickstartValueError(formatErrorMsg(self.lineno, msg="Cannot install to read-only media %s." % n))
 
                 should_clear = storage.shouldClear(disk)
                 if disk and (disk.partitioned or should_clear):
                     kwargs["parents"] = [disk]
                     break
                 elif disk:
-                    raise KickstartValueError, formatErrorMsg(self.lineno, msg="Specified unpartitioned disk %s in partition command" % self.disk)
+                    raise KickstartValueError(formatErrorMsg(self.lineno, msg="Specified unpartitioned disk %s in partition command" % self.disk))
 
             if not kwargs["parents"]:
-                raise KickstartValueError, formatErrorMsg(self.lineno, msg="Specified nonexistent disk %s in partition command" % self.disk)
+                raise KickstartValueError(formatErrorMsg(self.lineno, msg="Specified nonexistent disk %s in partition command" % self.disk))
 
         kwargs["grow"] = self.grow
         kwargs["size"] = self.size
@@ -1012,7 +1011,7 @@ class PartitionData(commands.partition.F18_PartData):
         if self.onPart:
             device = devicetree.getDeviceByName(udev.udev_resolve_devspec(self.onPart))
             if not device:
-                raise KickstartValueError, formatErrorMsg(self.lineno, msg="Specified nonexistent partition %s in partition command" % self.onPart)
+                raise KickstartValueError(formatErrorMsg(self.lineno, msg="Specified nonexistent partition %s in partition command" % self.onPart))
 
             removeExistingFormat(device, storage)
             if self.resize:
@@ -1089,7 +1088,7 @@ class RaidData(commands.raid.F18_RaidData):
             ksdata.onPart[kwargs["name"]] = devicename
 
             if devicetree.getDeviceByName(kwargs["name"]):
-                raise KickstartValueError, formatErrorMsg(self.lineno, msg="PV partition defined multiple times")
+                raise KickstartValueError(formatErrorMsg(self.lineno, msg="PV partition defined multiple times"))
 
             self.mountpoint = ""
         elif self.mountpoint.startswith("btrfs."):
@@ -1098,7 +1097,7 @@ class RaidData(commands.raid.F18_RaidData):
             ksdata.onPart[kwargs["name"]] = devicename
 
             if devicetree.getDeviceByName(kwargs["name"]):
-                raise KickstartValueError, formatErrorMsg(self.lineno, msg="BTRFS partition defined multiple times")
+                raise KickstartValueError(formatErrorMsg(self.lineno, msg="BTRFS partition defined multiple times"))
 
             self.mountpoint = ""
         else:
@@ -1112,17 +1111,17 @@ class RaidData(commands.raid.F18_RaidData):
 
         # Sanity check mountpoint
         if self.mountpoint != "" and self.mountpoint[0] != '/':
-            raise KickstartValueError, formatErrorMsg(self.lineno, msg="The mount point is not valid.")
+            raise KickstartValueError(formatErrorMsg(self.lineno, msg="The mount point is not valid."))
 
         # If this specifies an existing request that we should not format,
         # quit here after setting up enough information to mount it later.
         if not self.format:
             if not devicename:
-                raise KickstartValueError, formatErrorMsg(self.lineno, msg="--noformat used without --device")
+                raise KickstartValueError(formatErrorMsg(self.lineno, msg="--noformat used without --device"))
 
             dev = devicetree.getDeviceByName(devicename)
             if not dev:
-                raise KickstartValueError, formatErrorMsg(self.lineno, msg="No preexisting RAID device with the name \"%s\" was found." % devicename)
+                raise KickstartValueError(formatErrorMsg(self.lineno, msg="No preexisting RAID device with the name \"%s\" was found." % devicename))
 
             dev.format.mountpoint = self.mountpoint
             dev.format.mountopts = self.fsopts
@@ -1139,7 +1138,7 @@ class RaidData(commands.raid.F18_RaidData):
                 except IndexError:
                     dev = None
             if not dev:
-                raise KickstartValueError, formatErrorMsg(self.lineno, msg="Tried to use undefined partition %s in RAID specification" % mem)
+                raise KickstartValueError(formatErrorMsg(self.lineno, msg="Tried to use undefined partition %s in RAID specification" % mem))
 
             raidmems.append(dev)
 
@@ -1150,7 +1149,7 @@ class RaidData(commands.raid.F18_RaidData):
                                      mountpoint=self.mountpoint,
                                      mountopts=self.fsopts)
         if not kwargs["format"].type:
-            raise KickstartValueError, formatErrorMsg(self.lineno, msg="The \"%s\" filesystem type is not supported." % ty)
+            raise KickstartValueError(formatErrorMsg(self.lineno, msg="The \"%s\" filesystem type is not supported." % ty))
 
         kwargs["name"] = devicename
         kwargs["level"] = self.level
@@ -1165,7 +1164,7 @@ class RaidData(commands.raid.F18_RaidData):
         if self.preexist:
             device = devicetree.getDeviceByName(devicename)
             if not device:
-                raise KickstartValueError, formatErrorMsg(self.lineno, msg="Specifeid nonexistent RAID %s in raid command" % devicename)
+                raise KickstartValueError(formatErrorMsg(self.lineno, msg="Specifeid nonexistent RAID %s in raid command" % devicename))
 
             removeExistingFormat(device, storage)
             devicetree.registerAction(ActionCreateFormat(device, kwargs["format"]))
@@ -1185,7 +1184,7 @@ class RaidData(commands.raid.F18_RaidData):
             try:
                 request = storage.newMDArray(**kwargs)
             except ValueError as e:
-                raise KickstartValueError, formatErrorMsg(self.lineno, msg=str(e))
+                raise KickstartValueError(formatErrorMsg(self.lineno, msg=str(e)))
 
             storage.createDevice(request)
 
@@ -1357,24 +1356,24 @@ class VolGroupData(commands.volgroup.FC16_VolGroupData):
                 except IndexError:
                     dev = None
             if not dev:
-                raise KickstartValueError, formatErrorMsg(self.lineno, msg="Tried to use undefined partition %s in Volume Group specification" % pv)
+                raise KickstartValueError(formatErrorMsg(self.lineno, msg="Tried to use undefined partition %s in Volume Group specification" % pv))
 
             pvs.append(dev)
 
         if len(pvs) == 0 and not self.preexist:
-            raise KickstartValueError, formatErrorMsg(self.lineno, msg="Volume group defined without any physical volumes.  Either specify physical volumes or use --useexisting.")
+            raise KickstartValueError(formatErrorMsg(self.lineno, msg="Volume group defined without any physical volumes.  Either specify physical volumes or use --useexisting."))
 
         if self.pesize not in getPossiblePhysicalExtents(floor=1024):
-            raise KickstartValueError, formatErrorMsg(self.lineno, msg="Volume group specified invalid pesize")
+            raise KickstartValueError(formatErrorMsg(self.lineno, msg="Volume group specified invalid pesize"))
 
         # If --noformat or --useexisting was given, there's really nothing to do.
         if not self.format or self.preexist:
             if not self.vgname:
-                raise KickstartValueError, formatErrorMsg(self.lineno, msg="--noformat or --useexisting used without giving a name")
+                raise KickstartValueError(formatErrorMsg(self.lineno, msg="--noformat or --useexisting used without giving a name"))
 
             dev = devicetree.getDeviceByName(self.vgname)
             if not dev:
-                raise KickstartValueError, formatErrorMsg(self.lineno, msg="No preexisting VG with the name \"%s\" was found." % self.vgname)
+                raise KickstartValueError(formatErrorMsg(self.lineno, msg="No preexisting VG with the name \"%s\" was found." % self.vgname))
         elif self.vgname in (vg.name for vg in storage.vgs):
             raise KickstartValueError(formatErrorMsg(self.lineno, msg="The volume group name \"%s\" is already in use." % self.vgname))
         else:
diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py
index 058e9d5..e9aa5b6 100644
--- a/pyanaconda/ui/gui/spokes/network.py
+++ b/pyanaconda/ui/gui/spokes/network.py
@@ -145,14 +145,14 @@ class CellRendererSignal(Gtk.CellRendererPixbuf):
         if prop.name == 'signal':
             return self.signal
         else:
-            raise AttributeError, 'unknown property %s' % prop.name
+            raise AttributeError('unknown property %s' % prop.name)
 
     def do_set_property(self, prop, value):
         if prop.name == 'signal':
             self.signal = value
             self._set_icon_name(value)
         else:
-            raise AttributeError, 'unknown property %s' % prop.name
+            raise AttributeError('unknown property %s' % prop.name)
 
     def _set_icon_name(self, value):
 
@@ -199,14 +199,14 @@ class CellRendererSecurity(Gtk.CellRendererPixbuf):
         if prop.name == 'security':
             return self.security
         else:
-            raise AttributeError, 'unknown property %s' % prop.name
+            raise AttributeError('unknown property %s' % prop.name)
 
     def do_set_property(self, prop, value):
         if prop.name == 'security':
             self.security = value
             self._set_icon_name(value)
         else:
-            raise AttributeError, 'unknown property %s' % prop.name
+            raise AttributeError('unknown property %s' % prop.name)
 
     def _set_icon_name(self, security):
         self.icon_name = ""
-- 
1.8.1.2



More information about the anaconda-patches mailing list