summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Wilson <msw@redhat.com>2001-06-25 05:50:45 +0000
committerMatt Wilson <msw@redhat.com>2001-06-25 05:50:45 +0000
commit0d308d86ae5a20cbad5aa720c7ed685325200b9d (patch)
treece759de8c1949586ef2a2be3b1f1cbc8850b7121
parent7d724caa031e91e208d696be57f9fd38700de4bc (diff)
downloadanaconda-0d308d86ae5a20cbad5aa720c7ed685325200b9d.tar.gz
anaconda-0d308d86ae5a20cbad5aa720c7ed685325200b9d.tar.xz
anaconda-0d308d86ae5a20cbad5aa720c7ed685325200b9d.zip
register a parted exception handler for gui mode
modified isys.makeDevInode to use /dev/foo if it is there, while preserving backwards compatible behavior import fsset for workstation, it needs to find the ext2 filesystemtype for some reason skip drives that can't be opened or partition tables that can't be read. we still need to handle 'fresh' disks better.
-rwxr-xr-xgui.py29
-rw-r--r--installclasses/workstation.py1
-rw-r--r--isys/isys.py13
-rw-r--r--partitioning.py16
4 files changed, 49 insertions, 10 deletions
diff --git a/gui.py b/gui.py
index 9ef3b6b95..f2e4447fc 100755
--- a/gui.py
+++ b/gui.py
@@ -25,7 +25,8 @@ import iutil
import string
import isys
import sys
-from translate import cat, _
+import parted
+from translate import cat, _, N_
from gnome.ui import *
from gnome.xmhtml import *
from gtk import *
@@ -83,6 +84,31 @@ def processEvents():
while events_pending ():
mainiteration (FALSE)
+def partedExceptionWindow(exc):
+ print exc.type_string
+ print exc.message
+ print exc.options
+ win = GnomeDialog (exc.type_string)
+ win.vbox.pack_start (GtkLabel(exc.message))
+ numButtons = 0
+ buttonToAction = {}
+
+ flags = ((parted.EXCEPTION_YES, N_("Yes")),
+ (parted.EXCEPTION_NO, N_("No")),
+ (parted.EXCEPTION_OK, N_("Ok")),
+ (parted.EXCEPTION_RETRY, N_("Retry")),
+ (parted.EXCEPTION_IGNORE, N_("Ignore")),
+ (parted.EXCEPTION_CANCEL, N_("Cancel")))
+ for flag, string in flags:
+ if exc.options & flag:
+ win.append_button (_(string))
+ buttonToAction[numButtons] = flag
+ numButtons = numButtons + 1
+ win.show_all()
+ rc = win.run()
+ print rc, buttonToAction
+ return buttonToAction[rc]
+
class WaitWindow:
def __init__(self, title, text):
self.window = GtkWindow (WINDOW_POPUP)
@@ -296,6 +322,7 @@ class InstallInterface:
id.fsset.registerMessageWindow(self.messageWindow)
id.fsset.registerProgressWindow(self.progressWindow)
+ parted.exception_set_handler(partedExceptionWindow)
lang = id.instLanguage.getCurrent()
lang = id.instLanguage.getLangNick(lang)
diff --git a/installclasses/workstation.py b/installclasses/workstation.py
index fdfc15384..a0364f4a5 100644
--- a/installclasses/workstation.py
+++ b/installclasses/workstation.py
@@ -3,6 +3,7 @@ from translate import N_
import os
import iutil
from partitioning import *
+from fsset import *
from autopart import CLEARPART_TYPE_LINUX
from autopart import CLEARPART_TYPE_ALL
from autopart import CLEARPART_TYPE_NONE
diff --git a/isys/isys.py b/isys/isys.py
index 219d8136f..eec388d56 100644
--- a/isys/isys.py
+++ b/isys/isys.py
@@ -196,8 +196,17 @@ def cdromList():
def moduleListByType(type):
return _isys.modulelist(type)
-def makeDevInode(name, fn):
- return _isys.mkdevinode(name, fn)
+def makeDevInode(name, fn=None):
+ if fn:
+ _isys.mkdevinode(name, fn)
+ return fn
+ path = '/dev/%s' % (name,)
+ try:
+ os.stat(path)
+ except OSError:
+ path = '/tmp/%s' % (name,)
+ _isys.mkdevinode(name, fn)
+ return path
def inet_ntoa (addr):
return "%d.%d.%d.%d" % ((addr >> 24) & 0x000000ff,
diff --git a/partitioning.py b/partitioning.py
index cc4cdb44f..0cc154f7d 100644
--- a/partitioning.py
+++ b/partitioning.py
@@ -477,8 +477,8 @@ class PartitionRequests:
self.deletes = []
# identifier used for raid partitions
self.nextUniqueID = 1
- if diskset:
- self.setFromDisk(diskset)
+# if diskset:
+# self.setFromDisk(diskset)
def setFromDisk(self, diskset):
@@ -596,6 +596,7 @@ class PartitionRequests:
class DiskSet:
+ skippedDisks = []
def __init__ (self):
self.disks = {}
@@ -736,20 +737,21 @@ class DiskSet:
if self.disks:
return
for drive in self.driveList ():
+ if drive in DiskSet.skippedDisks:
+ continue
deviceFile = '/dev/' + drive
if not os.access(deviceFile, os.R_OK):
- deviceFile = '/tmp/' + drive
- isys.makeDevInode(drive, deviceFile)
-
+ deviceFile = isys.makeDevInode(drive)
try:
dev = parted.PedDevice.get (deviceFile)
except parted.error, msg:
- raise PartitioningError, msg
+ DiskSet.skippedDisks.append(drive)
+ continue
try:
disk = parted.PedDisk.open(dev)
self.disks[drive] = disk
except parted.error, msg:
- raise PartitioningError, msg
+ DiskSet.skippedDisks.append(drive)
def partitionTypes (self):
rc = []