diff options
author | Valerij Fredriksen <valerijf@oath.com> | 2018-04-25 13:17:23 +0200 |
---|---|---|
committer | Valerij Fredriksen <valerijf@oath.com> | 2018-04-25 13:17:23 +0200 |
commit | cdfdb9f134a6decc89993ea1dc6a2376ec675a74 (patch) | |
tree | 2857918d15bb346535e5784c49e927b3e4e030a0 /node-admin | |
parent | 8e3197ed53c193449fca986dff7939707590e556 (diff) |
SecretAgentScheduleMaker -> SecretAgentCheckConfig
Diffstat (limited to 'node-admin')
-rw-r--r-- | node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/StorageMaintainer.java | 6 | ||||
-rw-r--r-- | node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/SecretAgentCheckConfig.java (renamed from node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/SecretAgentScheduleMaker.java) | 14 | ||||
-rw-r--r-- | node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/util/SecretAgentCheckConfigTest.java (renamed from node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/util/SecretAgentScheduleMakerTest.java) | 14 |
3 files changed, 17 insertions, 17 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/StorageMaintainer.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/StorageMaintainer.java index b19a424bd82..d150fc03662 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/StorageMaintainer.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/StorageMaintainer.java @@ -16,7 +16,7 @@ import com.yahoo.vespa.hosted.node.admin.docker.DockerOperations; import com.yahoo.vespa.hosted.node.admin.logging.FilebeatConfigProvider; import com.yahoo.vespa.hosted.node.admin.component.Environment; import com.yahoo.vespa.hosted.node.admin.util.PrefixLogger; -import com.yahoo.vespa.hosted.node.admin.util.SecretAgentScheduleMaker; +import com.yahoo.vespa.hosted.node.admin.util.SecretAgentCheckConfig; import java.io.IOException; import java.io.InputStreamReader; @@ -70,11 +70,11 @@ public class StorageMaintainer { containerName, Paths.get("/etc/yamas-agent/")); Path vespaCheckPath = environment.pathInNodeUnderVespaHome("libexec/yms/yms_check_vespa"); - SecretAgentScheduleMaker vespaSchedule = new SecretAgentScheduleMaker("vespa", 60, vespaCheckPath, "all") + SecretAgentCheckConfig vespaSchedule = new SecretAgentCheckConfig("vespa", 60, vespaCheckPath, "all") .withTag("parentHostname", environment.getParentHostHostname()); Path hostLifeCheckPath = environment.pathInNodeUnderVespaHome("libexec/yms/yms_check_host_life"); - SecretAgentScheduleMaker hostLifeSchedule = new SecretAgentScheduleMaker("host-life", 60, hostLifeCheckPath) + SecretAgentCheckConfig hostLifeSchedule = new SecretAgentCheckConfig("host-life", 60, hostLifeCheckPath) .withTag("namespace", "Vespa") .withTag("role", "tenants") .withTag("flavor", node.getFlavor()) diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/SecretAgentScheduleMaker.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/SecretAgentCheckConfig.java index 5d378bc0b3e..6d7a05c59c1 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/SecretAgentScheduleMaker.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/SecretAgentCheckConfig.java @@ -8,11 +8,11 @@ import java.util.LinkedHashMap; import java.util.Map; /** - * Helper class to generate and write the secret-agent schedule file. + * Helper class to generate and write the secret-agent check config files. * * @author freva */ -public class SecretAgentScheduleMaker { +public class SecretAgentCheckConfig { private final String id; private final int interval; private final Path checkExecutable; @@ -20,19 +20,19 @@ public class SecretAgentScheduleMaker { private String user = "nobody"; private final Map<String, Object> tags = new LinkedHashMap<>(); - public SecretAgentScheduleMaker(String id, int interval, Path checkExecutable, String... arguments) { + public SecretAgentCheckConfig(String id, int interval, Path checkExecutable, String... arguments) { this.id = id; this.interval = interval; this.checkExecutable = checkExecutable; this.arguments = arguments; } - public SecretAgentScheduleMaker withRunAsUser(String user) { + public SecretAgentCheckConfig withRunAsUser(String user) { this.user = user; return this; } - public SecretAgentScheduleMaker withTag(String tagKey, Object tagValue) { + public SecretAgentCheckConfig withTag(String tagKey, Object tagValue) { tags.put(tagKey, tagValue); return this; } @@ -40,11 +40,11 @@ public class SecretAgentScheduleMaker { public void writeTo(Path yamasAgentDirectory) throws IOException { if (! Files.exists(yamasAgentDirectory)) yamasAgentDirectory.toFile().mkdirs(); Path scheduleFilePath = yamasAgentDirectory.resolve(id + ".yaml"); - Files.write(scheduleFilePath, toString().getBytes()); + Files.write(scheduleFilePath, render().getBytes()); scheduleFilePath.toFile().setReadable(true, false); // Give everyone read access to the schedule file } - public String toString() { + public String render() { StringBuilder stringBuilder = new StringBuilder() .append("- id: ").append(id).append("\n") .append(" interval: ").append(interval).append("\n") diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/util/SecretAgentScheduleMakerTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/util/SecretAgentCheckConfigTest.java index e61be7e2bac..b745360cee3 100644 --- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/util/SecretAgentScheduleMakerTest.java +++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/util/SecretAgentCheckConfigTest.java @@ -10,11 +10,11 @@ import static org.junit.Assert.assertEquals; /** * @author valerijf */ -public class SecretAgentScheduleMakerTest { +public class SecretAgentCheckConfigTest { @Test public void generateFullSecretAgentScheduleTest() { - SecretAgentScheduleMaker scheduleMaker = new SecretAgentScheduleMaker("system-checks", 60, + SecretAgentCheckConfig scheduleMaker = new SecretAgentCheckConfig("system-checks", 60, Paths.get("/some/test"), "arg1", "arg2 with space") .withTag("tenantName", "vespa") .withTag("applicationName", "canary-docker") @@ -49,30 +49,30 @@ public class SecretAgentScheduleMakerTest { " role: tenants\n" + " flavor: docker\n" + " state: active\n" + - " zone: test.us-west-5\n", scheduleMaker.toString()); + " zone: test.us-west-5\n", scheduleMaker.render()); } @Test public void generateMinimalSecretAgentScheduleTest() { - SecretAgentScheduleMaker scheduleMaker = new SecretAgentScheduleMaker("system-checks", 60, + SecretAgentCheckConfig scheduleMaker = new SecretAgentCheckConfig("system-checks", 60, Paths.get("/some/test")); assertEquals( "- id: system-checks\n" + " interval: 60\n" + " user: nobody\n" + - " check: /some/test\n", scheduleMaker.toString()); + " check: /some/test\n", scheduleMaker.render()); } @Test public void generateSecretAgentScheduleWithDifferentUserTest() { - SecretAgentScheduleMaker scheduleMaker = new SecretAgentScheduleMaker("system-checks", 60, + SecretAgentCheckConfig scheduleMaker = new SecretAgentCheckConfig("system-checks", 60, Paths.get("/some/test")).withRunAsUser("barfoo"); assertEquals( "- id: system-checks\n" + " interval: 60\n" + " user: barfoo\n" + - " check: /some/test\n", scheduleMaker.toString()); + " check: /some/test\n", scheduleMaker.render()); } } |