diff options
author | Martin Polden <mpolden@mpolden.no> | 2019-09-23 09:20:53 +0200 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2019-09-24 09:29:30 +0200 |
commit | b09dcca5aee910f2ac7d6f5cb2169a149c27be80 (patch) | |
tree | e71460c05d85130010907376ed8e9c0a348ae27f /node-repository/src/main | |
parent | 76bc54dc3de81c560df16b25b50ad8632bb87128 (diff) |
Write firmwareVerified event
Diffstat (limited to 'node-repository/src/main')
-rw-r--r-- | node-repository/src/main/java/com/yahoo/vespa/hosted/provision/Node.java | 7 | ||||
-rw-r--r-- | node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/v2/NodePatcher.java | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/Node.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/Node.java index 61d5909ce6f..fa439e50fbd 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/Node.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/Node.java @@ -299,6 +299,13 @@ public final class Node { return this.with(newStatus).with(newHistory); } + /** Returns a copy of this node with firmware verified at the given instant */ + public Node withFirmwareVerifiedAt(Instant instant) { + var newStatus = status.withFirmwareVerifiedAt(instant); + var newHistory = history.with(new History.Event(History.Event.Type.firmwareVerified, Agent.system, instant)); + return this.with(newStatus).with(newHistory); + } + /** Returns a copy of this node with the given history. */ public Node with(History history) { return new Node(id, ipConfig, hostname, parentHostname, flavor, status, state, allocation, history, type, reports, modelName); diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/v2/NodePatcher.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/v2/NodePatcher.java index 8ec21a246bc..5f4c300b496 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/v2/NodePatcher.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/v2/NodePatcher.java @@ -122,7 +122,7 @@ public class NodePatcher { case "currentOsVersion" : return node.withCurrentOsVersion(Version.fromString(asString(value)), clock.instant()); case "currentFirmwareCheck": - return node.with(node.status().withFirmwareVerifiedAt(Instant.ofEpochMilli(asLong(value)))); + return node.withFirmwareVerifiedAt(Instant.ofEpochMilli(asLong(value))); case "failCount" : return node.with(node.status().setFailCount(asLong(value).intValue())); case "flavor" : |