From 836b791d745d86cd62fe6f4c713abe0cef0f5618 Mon Sep 17 00:00:00 2001 From: Jonathon Anderson Date: Thu, 19 Sep 2024 11:40:10 -0600 Subject: [PATCH] Additional help test when container.RunDir already exists - Closes #1389 Signed-off-by: Jonathon Anderson --- CHANGELOG.md | 4 ++++ internal/app/wwctl/container/exec/main.go | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f0f4751..5ad902ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Correctly extract smbios asset key during Grub boot. #1291 - Refactor of `wwinit/init` to more properly address rootfs options. #1098 +### Added + +- Additional help test when container.RunDir already exists. #1389 + ## v4.5.7, 2024-09-11 ### Added diff --git a/internal/app/wwctl/container/exec/main.go b/internal/app/wwctl/container/exec/main.go index 336218a9..92713511 100644 --- a/internal/app/wwctl/container/exec/main.go +++ b/internal/app/wwctl/container/exec/main.go @@ -4,7 +4,6 @@ package exec import ( - "errors" "fmt" "os" "os/exec" @@ -42,7 +41,7 @@ func runContainedCmd(cmd *cobra.Command, containerName string, args []string) (e runDir := container.RunDir(containerName) if err := os.Mkdir(runDir, 0750); err != nil { if _, existerr := os.Stat(runDir); !os.IsNotExist(existerr) { - return errors.New("run directory already exists: another container command may already be running") + return fmt.Errorf("run directory already exists: another container command may already be running (otherwise, remove %s)", runDir) } else { return fmt.Errorf("unable to create run directory: %w", err) }