Skip to content

Commit

Permalink
osbuild/mkdir: make Mode a pointer
Browse files Browse the repository at this point in the history
The default value for the `os.FileMode` is zero, but the actual default
value used by the stage if no value is specified in the options is
`0777`. By using the pointer, we'll allow one to specify `0000`
permissions as a value which won't be omitted from the stage options.

Signed-off-by: Tomáš Hozza <[email protected]>
  • Loading branch information
thozza authored and achilleas-k committed Jan 19, 2023
1 parent c1c26b2 commit 8d0f2d7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion internal/manifest/commit_deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (p *OSTreeDeployment) serialize() osbuild.Pipeline {
Paths: []osbuild.MkdirStagePath{
{
Path: "/boot/efi",
Mode: os.FileMode(0700),
Mode: common.ToPtr(os.FileMode(0700)),
},
},
}))
Expand Down
8 changes: 4 additions & 4 deletions internal/osbuild/mkdir_stage.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ 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
ExistOk bool `json:"exist_ok,omitempty"` // If true, do not fail if the target directory already exists
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
ExistOk bool `json:"exist_ok,omitempty"` // If true, do not fail if the target directory already exists
}

func (MkdirStageOptions) isStageOptions() {}
Expand Down

0 comments on commit 8d0f2d7

Please sign in to comment.