Skip to content
This repository has been archived by the owner on Sep 4, 2021. It is now read-only.

Commit

Permalink
kube-aws: fail if configPath (cluster.yaml) already exists
Browse files Browse the repository at this point in the history
If the cluster.yaml file exists and is longer than the new version being
written, the resulting cluster.yaml will contain portions of the previous
version. Open it with os.O_EXCL, causing an error if the file already
exists.
  • Loading branch information
zuercher committed Apr 22, 2016
1 parent 26244de commit 5445976
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion multi-node/aws/cmd/kube-aws/command_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func runCmdInit(cmd *cobra.Command, args []string) error {
return fmt.Errorf("Error parsing default config template: %v", err)
}

out, err := os.OpenFile(configPath, os.O_CREATE|os.O_WRONLY, 0600)
out, err := os.OpenFile(configPath, os.O_CREATE|os.O_WRONLY|os.O_EXCL, 0600)
if err != nil {
return fmt.Errorf("Error opening %s : %v", configPath, err)
}
Expand Down

0 comments on commit 5445976

Please sign in to comment.