| 311 | } |
| 312 | |
| 313 | func ensureDirectoryWritable(path string) error { |
| 314 | if err := os.MkdirAll(path, 0o700); err != nil { |
| 315 | return err |
| 316 | } |
| 317 | |
| 318 | testFile, err := os.Create(filepath.Join(path, "writeable-test")) |
| 319 | if err != nil { |
| 320 | return err |
| 321 | } |
| 322 | if err := testFile.Close(); err != nil { |
| 323 | log.Println("failed to close writeable-test file:", err) |
| 324 | } |
| 325 | return os.RemoveAll(testFile.Name()) |
| 326 | } |
| 327 | |
| 328 | func ReadGlobals(c *container.C, cfg []config.Node) (map[string]interface{}, []config.Node, error) { |
| 329 | globals := config.NewMap(nil, config.Node{Children: cfg}) |