@@ -361,7 +361,10 @@ def run_guestfs_mount(image_path, mount_target):
361
361
g .close ()
362
362
363
363
364
- def diff_metal (diff_from , diff_to ):
364
+ # Generator that will mount up metal image filesystems and yield
365
+ # the paths to be used for analysis and then clean up once given back
366
+ # control.
367
+ def diff_metal_helper (diff_from , diff_to ):
365
368
metal_from = get_metal_path (diff_from )
366
369
metal_to = get_metal_path (diff_to )
367
370
@@ -394,8 +397,8 @@ def diff_metal(diff_from, diff_to):
394
397
if not p .is_alive ():
395
398
raise Exception (f"A guestfs process for { os .path .basename (d )} died unexpectedly." )
396
399
397
- # Now that the mounts are live, we can diff them
398
- git_diff ( mount_dir_from , mount_dir_to )
400
+ # Allow the caller to operate on these values
401
+ yield mount_dir_from , mount_dir_to
399
402
400
403
finally :
401
404
# Unmount the FUSE binds, this will make the guestfs mount calls return
@@ -413,6 +416,11 @@ def diff_metal(diff_from, diff_to):
413
416
shutdown_process (p_to )
414
417
415
418
419
+ def diff_metal (diff_from , diff_to ):
420
+ for mount_dir_from , mount_dir_to in diff_metal_helper (diff_from , diff_to ):
421
+ git_diff (mount_dir_from , mount_dir_to )
422
+
423
+
416
424
def diff_cmd_outputs (cmd , path_from , path_to , strategy : DiffCmdOutputStrategy = DiffCmdOutputStrategy .TEMPLATE ):
417
425
workingdir = None
418
426
with tempfile .NamedTemporaryFile (prefix = cmd [0 ] + '-' ) as from_output , \
0 commit comments