aboutsummaryrefslogtreecommitdiffstats
path: root/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/container/ContainerOperations.java
diff options
context:
space:
mode:
authorValerij Fredriksen <valerijf@yahooinc.com>2021-11-15 16:39:47 +0100
committerValerij Fredriksen <valerijf@yahooinc.com>2021-11-15 16:39:47 +0100
commit15fb3e939af9ef532ca91ae14d96e493cb0aad34 (patch)
treee13725734af8ce34020debea04e6a5123bc752f8 /node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/container/ContainerOperations.java
parentf322121bbe051b8c0e9b2efd6218468234e30928 (diff)
Require UnixUser to ContainerEngine::execute
Diffstat (limited to 'node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/container/ContainerOperations.java')
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/container/ContainerOperations.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/container/ContainerOperations.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/container/ContainerOperations.java
index 3017773700a..8a66373c28b 100644
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/container/ContainerOperations.java
+++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/container/ContainerOperations.java
@@ -7,6 +7,7 @@ import com.yahoo.vespa.hosted.node.admin.container.image.ContainerImageDownloade
import com.yahoo.vespa.hosted.node.admin.container.image.ContainerImagePruner;
import com.yahoo.vespa.hosted.node.admin.nodeagent.ContainerData;
import com.yahoo.vespa.hosted.node.admin.nodeagent.NodeAgentContext;
+import com.yahoo.vespa.hosted.node.admin.task.util.file.UnixUser;
import com.yahoo.vespa.hosted.node.admin.task.util.process.CommandLine;
import com.yahoo.vespa.hosted.node.admin.task.util.process.CommandResult;
@@ -66,13 +67,13 @@ public class ContainerOperations {
}
/** Executes a command inside container identified by given context. Does NOT throw on non-zero exit code */
- public CommandResult executeCommandInContainerAsRoot(NodeAgentContext context, String... command) {
- return executeCommandInContainerAsRoot(context, CommandLine.DEFAULT_TIMEOUT.toSeconds(), command);
+ public CommandResult executeCommandInContainer(NodeAgentContext context, UnixUser user, String... command) {
+ return executeCommandInContainer(context, user, CommandLine.DEFAULT_TIMEOUT, command);
}
/** Execute command inside container identified by given context. Does NOT throw on non-zero exit code */
- public CommandResult executeCommandInContainerAsRoot(NodeAgentContext context, Long timeoutSeconds, String... command) {
- return containerEngine.executeAsRoot(context, Duration.ofSeconds(timeoutSeconds), command);
+ public CommandResult executeCommandInContainer(NodeAgentContext context, UnixUser user, Duration timeout, String... command) {
+ return containerEngine.execute(context, user, timeout, command);
}
/** Execute command in inside containers network namespace, identified by given context. Throws on non-zero exit code */
@@ -142,7 +143,7 @@ public class ContainerOperations {
private String executeNodeCtlInContainer(NodeAgentContext context, String program) {
String[] command = new String[] {context.paths().underVespaHome("bin/vespa-nodectl").pathInContainer(), program};
- return executeCommandInContainerAsRoot(context, command).getOutput();
+ return executeCommandInContainer(context, context.users().vespa(), command).getOutput();
}
}