Skip to content

Commit 36f855a

Browse files
author
Stephen Cheng
committed
CA-417888: Check if dracut exists before calling weak_module in dmv.py
The install image doesn’t have dracut installed, while dmv.py calls weak_module which indirectly calls dracut when selecting drivers in install enviornment. Signed-off-by: Stephen Cheng <stephen.cheng@citrix.com>
1 parent cea2393 commit 36f855a

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

xcp/dmv.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -350,14 +350,16 @@ def create_dmv_symlink(self, name, ver):
350350
os.symlink(module_file, tmp_name)
351351
os.rename(tmp_name, module_sym)
352352
created = True
353-
modules = [module_sym]
354-
input_data = "\n".join(modules) + "\n"
355-
subprocess.run(
356-
["/usr/sbin/weak-modules", "--no-initramfs", "--add-modules"],
357-
input=input_data,
358-
text=True,
359-
check=True
360-
)
353+
# weak-modules will call dracut, while no dracut in install image
354+
if os.path.exists("/usr/bin/dracut"):
355+
modules = [module_sym]
356+
input_data = "\n".join(modules) + "\n"
357+
subprocess.run(
358+
["/usr/sbin/weak-modules", "--no-initramfs", "--add-modules"],
359+
input=input_data,
360+
text=True,
361+
check=True
362+
)
361363
if created:
362364
subprocess.run(["/usr/sbin/depmod", "-a"], check=True)
363365
uname_r = subprocess.run(["uname", '-r'], stdout=subprocess.PIPE, text=True,

0 commit comments

Comments
 (0)