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

[PATCH 1/2] Add a ignoreProtected= parameter to deviceImmutable that does the obvious.



This parameter basically means a protected partition cannot be modified or
deleted, but can be dealt with on a read-only basis.  Right now, the only
time we need that is so the hdiso install source can be written out to
/etc/fstab.
---
 storage/__init__.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/storage/__init__.py b/storage/__init__.py
index d7b53b6..db71902 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -479,7 +479,7 @@ class Storage(object):
 
         return dests
 
-    def deviceImmutable(self, device):
+    def deviceImmutable(self, device, ignoreProtected=False):
         """ Return any reason the device cannot be modified/removed.
 
             Return False if the device can be removed.
@@ -495,7 +495,7 @@ class Storage(object):
         if not isinstance(device, Device):
             raise ValueError("arg1 (%s) must be a Device instance" % device)
 
-        if device.name in self.protectedPartitions:
+        if not ignoreProtected and device.name in self.protectedPartitions:
             return _("This partition is holding the data for the hard "
                       "drive install.")
         elif isinstance(device, PartitionDevice) and device.isProtected:
-- 
1.6.1.3


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