From 3dff3e28740e160b1ec8e92edc735aef84e16e95 Mon Sep 17 00:00:00 2001 From: Valerij Fredriksen Date: Wed, 25 Apr 2018 13:17:46 +0200 Subject: Add helper methods --- .../vespa/hosted/node/admin/util/SecretAgentCheckConfig.java | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'node-admin') 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 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") -- cgit v1.2.3