diff options
author | Mike Fulbright <msf@redhat.com> | 2002-06-04 21:32:39 +0000 |
---|---|---|
committer | Mike Fulbright <msf@redhat.com> | 2002-06-04 21:32:39 +0000 |
commit | 746350054beea57df19c561cdd65f97ff20a4618 (patch) | |
tree | cb983666a88d127b130761aaf7985a77f0999d90 /partIntfHelpers.py | |
parent | 49cc366b31af6fb2a7e9524bd995ab6a4ec42a03 (diff) | |
download | anaconda-746350054beea57df19c561cdd65f97ff20a4618.tar.gz anaconda-746350054beea57df19c561cdd65f97ff20a4618.tar.xz anaconda-746350054beea57df19c561cdd65f97ff20a4618.zip |
Cleanup error messages in generic handling code, make sure you dont munge members of raid or lvm interactively, and misc cleanups
Diffstat (limited to 'partIntfHelpers.py')
-rw-r--r-- | partIntfHelpers.py | 71 |
1 files changed, 39 insertions, 32 deletions
diff --git a/partIntfHelpers.py b/partIntfHelpers.py index 07eff9ecb..41fc64d3d 100644 --- a/partIntfHelpers.py +++ b/partIntfHelpers.py @@ -97,6 +97,28 @@ def sanityCheckMountPoint(mntpt, fstype, preexisting): # its an existing partition so don't force a mount point return None +def isNotChangable(request, requestlist): + if request: + if request.getProtected(): + return _("You cannot %s this partition, as it is holding the data" + "for the hard drive install.") + + if requestlist.isRaidMember(request): + return _("You cannot %s this partition as it is part of " + "a RAID device") + + if request.type == REQUEST_LV: + # temporary message + return _("The %s action on logical volumes from the " + "treeview is not currently supported.") + + if requestlist.isLVMVolumeGroupMember(request): + return _("You cannot %s this partition, as it is part of a LVM " + "volume group.") + + return None + + def doDeletePartitionByRequest(intf, requestlist, partition): """Delete a partition from the request list. @@ -140,32 +162,10 @@ def doDeletePartitionByRequest(intf, requestlist, partition): request = requestlist.getRequestByDeviceName(device) if request: - if request.getProtected(): - intf.messageWindow(_("Unable To Delete"), - _("You cannot delete this " - "partition, as it is holding the data for " - "the hard drive install.")) - return 0 - - if requestlist.isRaidMember(request): - intf.messageWindow(_("Unable To Delete"), - _("You cannot delete this " - "partition, as it is part of a RAID device.")) - return 0 - - if request.type == REQUEST_LV: - # temporary message - intf.messageWindow(_("Unable To Delete"), - _("Deleting logical volumes from the " - "treeview is not currently supported.")) - return 0 - - if requestlist.isLVMVolumeGroupMember(request): - intf.messageWindow(_("Unable To Delete"), - _("You cannot delete this " - "partition, as it is part of a LVM " - "volume group.")) - return 0 + state = isNotChangable(request, requestlist) + if state is not None: + intf.messageWindow(_("Unable To Delete"), state % ("delete",)) + return (None, None) if confirmDeleteRequest(intf, request): requestlist.removeRequest(request) @@ -207,7 +207,15 @@ def doEditPartitionByRequest(intf, requestlist, part): return (None, None) if type(part) == type("RAID"): + + # see if device is in our partition requests, remove request = requestlist.getRequestByID(int(part)) + + if request: + state = isNotChangable(request, requestlist) + if state is not None: + intf.messageWindow(_("Unable To Edit"), state % ("edit",)) + return (None, None) if request.type == REQUEST_RAID: return ("RAID", request) @@ -245,12 +253,11 @@ def doEditPartitionByRequest(intf, requestlist, part): name = partedUtils.get_partition_name(part) request = requestlist.getRequestByDeviceName(name) if request: - if requestlist.isRaidMember(request): - intf.messageWindow( _("Unable to Edit"), - _("You cannot edit this partition " - "as it is part of a RAID device")) - return (None, None) - + state = isNotChangable(request, requestlist) + if state is not None: + intf.messageWindow(_("Unable To Edit"), state % ("edit",)) + return (None, None) + return ("PARTITION", request) else: # shouldn't ever happen raise ValueError, ("Trying to edit non-existent partition %s" |