osbuild/mkdir: support exist_ok stage option

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 <thozza@redhat.com>
This commit is contained in:
Tomáš Hozza 2023-01-18 16:07:42 +01:00 committed by Achilleas Koutsou
parent 7021c305e2
commit c1c26b2817

View file

@ -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() {}