From c1c26b2817c73f1083d79ad8f81dc005424104d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hozza?= Date: Wed, 18 Jan 2023 16:07:42 +0100 Subject: [PATCH] osbuild/mkdir: support `exist_ok` stage option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for `exist_ok` stage option added as part of PR#1224 [1], which allows to gracefully handle existence of a directory path specified to the stage. This will be helpful when creating custom directories in the image via customizations, because one can't know in advance whether the directory path won't be created by a package installed in the image. Not bumping the requires on osbuild, because this new option is not yet used by any image definition or customization. [1] https://github.com/osbuild/osbuild/pull/1224 Signed-off-by: Tomáš Hozza --- internal/osbuild/mkdir_stage.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/osbuild/mkdir_stage.go b/internal/osbuild/mkdir_stage.go index 9cc841807..aa478a083 100644 --- a/internal/osbuild/mkdir_stage.go +++ b/internal/osbuild/mkdir_stage.go @@ -9,8 +9,9 @@ type MkdirStageOptions struct { type MkdirStagePath struct { Path string `json:"path"` - Mode os.FileMode `json:"mode,omitempty"` // If not specified, the default mode is 0777 - Parents bool `json:"parents,omitempty"` // If true, create parent directories as needed + Mode os.FileMode `json:"mode,omitempty"` // If not specified, the default mode is 0777 + Parents bool `json:"parents,omitempty"` // If true, create parent directories as needed + ExistOk bool `json:"exist_ok,omitempty"` // If true, do not fail if the target directory already exists } func (MkdirStageOptions) isStageOptions() {}