From e754dc0033535d26faa2991c72275241bd3e7e89 Mon Sep 17 00:00:00 2001 From: Daniel Bast <2790401+dbast@users.noreply.github.com> Date: Sat, 15 Oct 2022 21:48:38 +0200 Subject: [PATCH] Switch from log.Printf(...) to ui.Message(...) --- builder/step_mount_image.go | 3 +-- builder/step_setup_chroot.go | 7 +++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/builder/step_mount_image.go b/builder/step_mount_image.go index 0c390e06..c7d577c0 100644 --- a/builder/step_mount_image.go +++ b/builder/step_mount_image.go @@ -4,7 +4,6 @@ import ( "context" "fmt" "io/ioutil" - "log" "os" "os/exec" "path/filepath" @@ -99,7 +98,7 @@ func (s *StepMountImage) Cleanup(state multistep.StateBag) { partitions := sortMountablePartitions(config.ImageConfig.ImagePartitions, true) for _, partition := range partitions { mountpoint := filepath.Join(s.MountPath, partition.Mountpoint) - log.Printf("unmounting %s", mountpoint) + ui.Message(fmt.Sprintf("unmounting %s", mountpoint)) _, err := exec.Command("umount", mountpoint).CombinedOutput() if err != nil { ui.Error(fmt.Sprintf("failed to unmount %s: %s", mountpoint, err.Error())) diff --git a/builder/step_setup_chroot.go b/builder/step_setup_chroot.go index 19e49260..6d7d0be5 100644 --- a/builder/step_setup_chroot.go +++ b/builder/step_setup_chroot.go @@ -4,7 +4,6 @@ import ( "context" "fmt" "io/ioutil" - "log" "os" "os/exec" "path/filepath" @@ -123,17 +122,17 @@ func (s *StepSetupChroot) Cleanup(state multistep.StateBag) { mountpoint := filepath.Join(imageMountpoint, chrootMount.DestinationPath) if canonical_path, err := filepath.EvalSymlinks(mountpoint); err == nil && canonical_path != mountpoint { - log.Printf("mountpoint %s is symlink to %s", mountpoint, canonical_path) + ui.Message(fmt.Sprintf("mountpoint %s is symlink to %s", mountpoint, canonical_path) mountpoint = canonical_path } if _, ok := mounted[mountpoint]; !ok { - log.Printf("omiting umount of %s, not mounted", mountpoint) + ui.Message(fmt.Sprintf("omiting umount of %s, not mounted", mountpoint)) continue } for i := 0; i < 3; i++ { - log.Printf("unmounting %s", mountpoint) + ui.Message(fmt.Sprintf("unmounting %s", mountpoint)) out, err := exec.Command("umount", mountpoint).CombinedOutput() if err != nil { if i == 2 {