[PATCH 1/2] Don't traceback on read only (write protected) disks (#471883)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a backport of a small part of commit:
http://git.fedorahosted.org/git/?p=anaconda.git;a=commitdiff;h=1380f13f0dad0108b8ed6ac02e249f53fb43156b

Which stops us from backtracing when we try to write a partitiontable to
a write protected disk (for example a writeprotected sdcard).
---
 partedUtils.py |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/partedUtils.py b/partedUtils.py
index 4b14329..0be98db 100644
--- a/partedUtils.py
+++ b/partedUtils.py
@@ -959,7 +959,16 @@ class DiskSet:
     def savePartitions (self):
         """Write the partition tables out to the disks."""
         for disk in self.disks.values():
-            disk.commit()
+            log.info("disk.commit() for %s" % (disk.dev.path,))
+            try:
+                disk.commit()
+            except:
+                # if this fails, remove the disk so we don't use it later
+                # Basically if we get here, badness has happened and we want
+                # to prevent tracebacks from ruining the day any more.
+                del disk
+                continue
+
             # FIXME: this belongs in parted itself, but let's do a hack...
             if iutil.isMactel() and disk.type.name == "gpt" and \
                     os.path.exists("/usr/sbin/gptsync"):
-- 
1.6.2.2

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux