[rhel7-branch 2/3] Include LUKSDevice information in kickstart data (#1139222)

mulkieran installerbot-noreply at redhat.com
Thu Jun 4 20:57:19 UTC 2015


From: mulhern <amulhern at redhat.com>

Resolves: rhbz#1139222

Previously, if a device had a child that was a LUKS device that child was
ignored when generating ksdata. What this meant was that that device's
format, which was luks, was used in generating the kickstart data.

Now, the LUKSDevice, which contains the format that should appear in the ks
output is used. This means that the LUKS format is used to set some ks data,
but the mountpoint and so forth are overwritten with the correct values
when the format on the LUKSDevice is used to populate those values.

The --passphrase option with passphrase continues to not appear in the
output anaconda-ks.cfg file.

Signed-off-by: mulhern <amulhern at redhat.com>
---
 blivet/__init__.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/blivet/__init__.py b/blivet/__init__.py
index f0e29d8..bf504d6 100644
--- a/blivet/__init__.py
+++ b/blivet/__init__.py
@@ -1980,6 +1980,11 @@ def updateKSData(self):
         if self.doAutoPart:
             return
 
+        self._updateCustomStorageKSData()
+
+    def _updateCustomStorageKSData(self):
+        """ Update KSData for custom storage. """
+
         # custom storage
         ksMap = {PartitionDevice: ("PartData", "partition"),
                  TmpFSDevice: ("PartData", "partition"),
@@ -1991,6 +1996,10 @@ def updateKSData(self):
         # make a list of ancestors of all used devices
         devices = list(set(a for d in list(self.mountpoints.values()) + self.swaps
                                 for a in d.ancestors))
+
+        # devices which share information with their distinct raw device
+        complementary_devices = [d for d in devices if d.raw_device is not d]
+
         devices.sort(key=lambda d: len(d.ancestors))
         for device in devices:
             cls = next((c for c in ksMap if isinstance(device, c)), None)
@@ -2003,6 +2012,14 @@ def updateKSData(self):
             cls = getattr(self.ksdata, class_attr)
             data = cls()    # all defaults
 
+            complements = [d for d in complementary_devices if d.raw_device is device]
+
+            if len(complements) > 1:
+                log.warning("omitting ksdata for %s, found too many (%d) complementary devices", device, len(complements))
+                continue
+
+            device = complements[0] if complements else device
+
             device.populateKSData(data)
 
             parent = getattr(self.ksdata, list_attr)


-- 
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/fe031790a96eff4eb1cc097f92a38022b00da680


More information about the anaconda-patches mailing list