[node-patches] Change in ovirt-node[master]: edit-node: only add dracut module lines if necessary

jboggs at redhat.com jboggs at redhat.com
Fri Sep 6 16:54:59 UTC 2013


Joey Boggs has uploaded a new change for review.

Change subject: edit-node: only add dracut module lines if necessary
......................................................................

edit-node: only add dracut module lines if necessary

Change-Id: I69ea49e9c057093ae1b47cfd63d8a6c0871f1772
Signed-off-by: Joey Boggs <jboggs at redhat.com>
---
M tools/edit-node
1 file changed, 13 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/33/18933/1

diff --git a/tools/edit-node b/tools/edit-node
index 455c78d..7a78f2f 100755
--- a/tools/edit-node
+++ b/tools/edit-node
@@ -1357,11 +1357,19 @@
         print("Creating initramfs")
         # ensure dmsquash-live dracut module is included
         d_conf = "%s/etc/dracut.conf" % self._instroot
-        dracut_conf = open(d_conf, "a")
-        dracut_conf.write('add_dracutmodules+="dmsquash-live"\n')
-        # ensure that isofs is included - needed to boot from a LiveCD
-        dracut_conf.write('add_drivers+="isofs"\n')
-        dracut_conf.close()
+        with open(d_conf) as f:
+            current = f.readlines()
+        add_modules = True
+        for line in current:
+            if line.startswith("add_dracutmodules") \
+                and "dmsquash-live" in line:
+                add_modules = False
+        if add_modules:
+            dracut_conf = open(d_conf, "a")
+            dracut_conf.write('add_dracutmodules+="dmsquash-live"\n')
+            # ensure that isofs is included - needed to boot from a LiveCD
+            dracut_conf.write('add_drivers+="isofs"\n')
+            dracut_conf.close()
         cmd = "rpm -q kernel"
         f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT,
                              preexec_fn=self._chroot)


-- 
To view, visit http://gerrit.ovirt.org/18933
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I69ea49e9c057093ae1b47cfd63d8a6c0871f1772
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Joey Boggs <jboggs at redhat.com>



More information about the node-patches mailing list