diff --git a/handler/handler.go b/handler/handler.go index 1b5f8e8..9f1a813 100644 --- a/handler/handler.go +++ b/handler/handler.go @@ -34,7 +34,7 @@ func (j *job) WriteFile(dir string, data *annotator.Annotations) error { // Create the necessary subdirectories. dir = dir + j.timestamp.Format("/2006/01/02/") - err = fs.MkdirAll(dir, 0777) + err = fs.MkdirAll(dir, 0755) if err != nil { return err } diff --git a/main.go b/main.go index bad67ec..d1c7ad0 100644 --- a/main.go +++ b/main.go @@ -5,6 +5,7 @@ import ( "flag" "log" "net" + "os" "sync" "time" @@ -72,6 +73,10 @@ func main() { flag.Parse() rtx.Must(flagx.ArgsFromEnv(flag.CommandLine), "Could not get args from environment variables") + // Create the datatype directory immediately, since pusher will crash + // without it. + rtx.Must(os.MkdirAll(*datadir, 0755), "Could not create datatype dir %s", datadir) + // Parse the node's name into its constituent parts. This ensures that the // value of the -hostname flag is actually valid. Additionally, virtual // nodes which are part of a managed instance group may have a random