Skip to content
This repository has been archived by the owner on Jun 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #713 from ekinanp/fix-config-write
Browse files Browse the repository at this point in the history
Ensure config dir exists before writing the wash.yaml file
  • Loading branch information
MikaelSmith committed Feb 6, 2020
2 parents 8e36868 + b0cb040 commit faddaa3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,11 @@ func writeEnabledPlugins(enabledPlugins []string, configFile string) error {
if err != nil {
return err
}
// Make sure that the Wash config file's directory exists. Otherwise,
// OpenFile will return an error.
if err := os.MkdirAll(filepath.Dir(configFile), 0750); err != nil {
return err
}
// Note that we do a raw append of "plugins: <enabled_plugins>" to preserve any
// existing data, including comments. The append should be OK because we know that
// the config file doesn't have a "plugins" key, so adding it will not mess anything
Expand Down

0 comments on commit faddaa3

Please sign in to comment.