aboutsummaryrefslogtreecommitdiffstats
path: root/node-admin
diff options
context:
space:
mode:
authorValerij Fredriksen <valerijf@oath.com>2018-10-10 14:17:27 +0200
committerValerij Fredriksen <valerijf@oath.com>2018-10-10 14:17:27 +0200
commitf87038f1fed9051729a4e3e4d3e305e52b607678 (patch)
tree526727de2602c14537489cf43343cb9e10d27fd1 /node-admin
parent0ecae8f7e356ff26457d9f826e966c84cf86bd3a (diff)
Resolve from String to avoid FileSystem
Diffstat (limited to 'node-admin')
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextImpl.java7
-rw-r--r--node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextImplTest.java4
2 files changed, 4 insertions, 7 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextImpl.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextImpl.java
index 268a074ac62..089815a06bc 100644
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextImpl.java
+++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextImpl.java
@@ -5,7 +5,6 @@ import com.yahoo.config.provision.NodeType;
import com.yahoo.vespa.athenz.api.AthenzService;
import com.yahoo.vespa.hosted.dockerapi.ContainerName;
-import java.nio.file.FileSystem;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Objects;
@@ -18,7 +17,6 @@ import java.util.logging.Logger;
public class NodeAgentContextImpl implements NodeAgentContext {
private static final Path ROOT = Paths.get("/");
- private final FileSystem fileSystem;
private final String logPrefix;
private final ContainerName containerName;
private final HostName hostName;
@@ -27,9 +25,8 @@ public class NodeAgentContextImpl implements NodeAgentContext {
private final Path pathToNodeRootOnHost;
private final Path pathToVespaHome;
- public NodeAgentContextImpl(FileSystem fileSystem, String hostname, NodeType nodeType, AthenzService identity,
+ public NodeAgentContextImpl(String hostname, NodeType nodeType, AthenzService identity,
Path pathToContainerStorage, Path pathToVespaHome) {
- this.fileSystem = Objects.requireNonNull(fileSystem);
this.hostName = HostName.from(Objects.requireNonNull(hostname));
this.containerName = ContainerName.fromHostname(hostname);
this.nodeType = Objects.requireNonNull(nodeType);
@@ -64,7 +61,7 @@ public class NodeAgentContextImpl implements NodeAgentContext {
if (! pathInNode.isAbsolute())
throw new IllegalArgumentException("Expected an absolute path in container, got: " + pathInNode);
- return fileSystem.getPath(pathToNodeRootOnHost.resolve(ROOT.relativize(pathInNode)).toString());
+ return pathToNodeRootOnHost.resolve(ROOT.relativize(pathInNode).toString());
}
@Override
diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextImplTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextImplTest.java
index d9b5505372d..2388e1e02b1 100644
--- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextImplTest.java
+++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextImplTest.java
@@ -58,9 +58,9 @@ public class NodeAgentContextImplTest {
public static NodeAgentContext nodeAgentFromHostname(FileSystem fileSystem, String hostname) {
final Path vespaHomeInContainer = Paths.get("/opt/vespa");
- final Path containerStoragePath = Paths.get("/home/docker");
+ final Path containerStoragePath = fileSystem.getPath("/home/docker");
- return new NodeAgentContextImpl(fileSystem, hostname, NodeType.tenant, new AthenzService("domain", "service"),
+ return new NodeAgentContextImpl(hostname, NodeType.tenant, new AthenzService("domain", "service"),
containerStoragePath, vespaHomeInContainer);
}
}