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

[rhel6-branch] Fix the autogenerated kickstart (#738580)



When using encrypted partitions, the autogenerated kickstart
had a wrong argument order resulting in kickstart errors.
---
 storage/devices.py |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/storage/devices.py b/storage/devices.py
index 0450ceb..dde9269 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -1702,12 +1702,31 @@ class LUKSDevice(DMCryptDevice):
                                uuid=None, exists=exists)
 
     def writeKS(self, f, preexisting=False, noformat=False, s=None):
+        # XXX This is a bad hack, but there's no better alternative.
+        # The self.format here is a filesystem object, and returns
+        # the mountpoint. The self.slave.format is a LUKS object,
+        # which just returns "--encrypted". We need to swith these two
+        # because the mountpoint should go after the ks command, like
+        # part or raid, and not at the end.
+        # Changing just the order of the writeKS methods does not help,
+        # because we need to get the mountpoint *inside* the string.
+        __self_format = self._format
+        __slave_format = self.slave._format
+
+        # exchange format devices
+        self._format = __slave_format
+        self.slave._format = __self_format
+
         self.slave.writeKS(f, preexisting=preexisting, noformat=noformat, s=s)
         f.write(" ")
         self.format.writeKS(f)
         if s:
             f.write(" %s" % s)
 
+        # restore format devices
+        self._format = __self_format
+        self.slave._format = __slave_format
+
     @property
     def size(self):
         if not self.exists or not self.partedDevice:
-- 
1.7.5.4


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