diff options
2 files changed, 4 insertions, 15 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/fs/ContainerFileSystemProvider.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/fs/ContainerFileSystemProvider.java index 843503d1cbf..964ed5e0e4d 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/fs/ContainerFileSystemProvider.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/fs/ContainerFileSystemProvider.java @@ -120,9 +120,7 @@ class ContainerFileSystemProvider extends FileSystemProvider { public void move(Path source, Path target, CopyOption... options) throws IOException { // Only called when both 'source' and 'target' have 'this' as the FS provider Path targetPathOnHost = pathOnHost(target); - try (SecureDirectoryStream<Path> sds = leafDirectoryStream(targetPathOnHost)) { - sds.move(pathOnHost(source), sds, targetPathOnHost.getFileName()); - } + provider(targetPathOnHost).move(pathOnHost(source), targetPathOnHost, addNoFollow(options)); } @Override diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/fs/ContainerFileSystemTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/fs/ContainerFileSystemTest.java index 07ef0b80d91..c3affccc32b 100644 --- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/fs/ContainerFileSystemTest.java +++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/fs/ContainerFileSystemTest.java @@ -169,18 +169,9 @@ class ContainerFileSystemTest { Files.createDirectories(link.getParent()); Files.createSymbolicLink(link, destination.getParent()); - { // Cannot write file via symlink - ContainerPath file = link.resolve("file"); - assertThrows(IOException.class, () -> Files.writeString(file, "hello")); - Files.writeString(file.pathOnHost(), "hello"); // Writing through host FS works - } - - { // Cannot move via symlink - ContainerPath file = containerFs.getPath("/file"); - Files.writeString(file, "world"); - assertThrows(IOException.class, () -> Files.move(file, link.resolve("dest"))); - Files.move(file.pathOnHost(), link.resolve("dest").pathOnHost()); // Moving through host FS works - } + ContainerPath file = link.resolve("file"); + assertThrows(IOException.class, () -> Files.writeString(file, "hello")); + Files.writeString(file.pathOnHost(), "hello"); // Writing through host FS works } private static void assertOwnership(ContainerPath path, int contUid, int contGid, int hostUid, int hostGid) throws IOException { |