summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Marius Venstad <jonmv@users.noreply.github.com>2018-03-13 13:29:44 +0100
committerGitHub <noreply@github.com>2018-03-13 13:29:44 +0100
commitfd2b9eb63a0ac58cedf9addee2235d329b4a4477 (patch)
tree8952d44188aec9c6ef5df3901e458570cc20fed4
parent64add316a329a057402fa839ee56c598f84d2a58 (diff)
parent832692c4ba452526b2694b1424a6d4e9f335b3d1 (diff)
Merge pull request #5307 from vespa-engine/jvenstad/guard-against-non-root-use-of-containerdata
Allow ContainerData to be used only under HostAdmin
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java
index 27e7cbff68e..336e947d7b4 100644
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java
+++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java
@@ -687,14 +687,19 @@ public class NodeAgentImpl implements NodeAgent {
ContainerData containerData = ContainerData.createClean(environment,
ContainerName.fromHostname(nodeSpec.hostname));
+ // ContainerData only works when root, which is the case only for HostAdmin so far -- config nodes are only used under HostAdmin.
if (nodeSpec.nodeType.equals(NodeType.config.name())) {
logger.info("Creating files needed by config server");
new ConfigServerContainerData(environment, nodeSpec.hostname).writeTo(containerData);
}
- logger.info("Creating files for message of the day and the bash prompt");
- new MotdContainerData(nodeSpec, environment).writeTo(containerData);
- new PromptContainerData(environment).writeTo(containerData);
+ // ContainerData only works when root, which is the case only for HostAdmin so far -- only AWS uses HostAdmin now.
+ if (environment.getRegion().startsWith("aws-")) {
+ logger.info("Creating files for message of the day and the bash prompt");
+ new MotdContainerData(nodeSpec, environment).writeTo(containerData);
+ new PromptContainerData(environment).writeTo(containerData);
+ }
+
}
}