diff options
author | Valerij Fredriksen <valerijf@oath.com> | 2018-04-25 13:17:46 +0200 |
---|---|---|
committer | Valerij Fredriksen <valerijf@oath.com> | 2018-04-25 13:17:46 +0200 |
commit | 3dff3e28740e160b1ec8e92edc735aef84e16e95 (patch) | |
tree | cb4f619216499d75ffae0d2671d529f00ee7271b /node-admin | |
parent | cdfdb9f134a6decc89993ea1dc6a2376ec675a74 (diff) |
Add helper methods
Diffstat (limited to 'node-admin')
-rw-r--r-- | node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/SecretAgentCheckConfig.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/SecretAgentCheckConfig.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/SecretAgentCheckConfig.java index 6d7a05c59c1..50e325c2149 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/SecretAgentCheckConfig.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/SecretAgentCheckConfig.java @@ -1,6 +1,8 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.node.admin.util; +import com.yahoo.vespa.hosted.node.admin.task.util.file.FileWriter; + import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -37,6 +39,11 @@ public class SecretAgentCheckConfig { return this; } + public void setTags(Map<String, Object> tags) { + this.tags.clear(); + this.tags.putAll(tags); + } + public void writeTo(Path yamasAgentDirectory) throws IOException { if (! Files.exists(yamasAgentDirectory)) yamasAgentDirectory.toFile().mkdirs(); Path scheduleFilePath = yamasAgentDirectory.resolve(id + ".yaml"); @@ -44,6 +51,10 @@ public class SecretAgentCheckConfig { scheduleFilePath.toFile().setReadable(true, false); // Give everyone read access to the schedule file } + public FileWriter getFileWriterTo(Path destinationPath) { + return new FileWriter(destinationPath, this::render); + } + public String render() { StringBuilder stringBuilder = new StringBuilder() .append("- id: ").append(id).append("\n") |