Ensure paths exist (or more permissions are needed later)

This commit is contained in:
Robert Muir 2015-04-23 16:01:16 -04:00
parent e2861bd7be
commit 573e81d2ea
1 changed files with 3 additions and 0 deletions

View File

@ -76,6 +76,7 @@ class Security {
paths.add(environment.workFile()); paths.add(environment.workFile());
paths.add(environment.workWithClusterFile()); paths.add(environment.workWithClusterFile());
for (Path path : environment.dataFiles()) { for (Path path : environment.dataFiles()) {
System.out.println("datapath=" + path);
paths.add(path); paths.add(path);
} }
for (Path path : environment.dataWithClusterFiles()) { for (Path path : environment.dataWithClusterFiles()) {
@ -97,6 +98,8 @@ class Security {
writer.write("grant {"); writer.write("grant {");
writer.write(System.lineSeparator()); writer.write(System.lineSeparator());
for (Path path : paths) { for (Path path : paths) {
// data paths actually may not exist yet.
Files.createDirectories(path);
// add each path twice: once for itself, again for files underneath it // add each path twice: once for itself, again for files underneath it
addPath(writer, encode(path), "read,readlink,write,delete"); addPath(writer, encode(path), "read,readlink,write,delete");
addRecursivePath(writer, encode(path), "read,readlink,write,delete"); addRecursivePath(writer, encode(path), "read,readlink,write,delete");