aboutsummaryrefslogtreecommitdiffstats
path: root/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/OsVersionStatusUpdater.java
blob: 4b4d2c8698da649ff59acd408c657f36a8f3114d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.maintenance;

import java.util.logging.Level;
import com.yahoo.vespa.hosted.controller.Controller;
import com.yahoo.vespa.hosted.controller.versions.OsVersionStatus;
import com.yahoo.yolean.Exceptions;

import java.time.Duration;

/**
 * @author mpolden
 */
public class OsVersionStatusUpdater extends Maintainer {

    public OsVersionStatusUpdater(Controller controller, Duration interval, JobControl jobControl) {
        super(controller, interval, jobControl);
    }

    @Override
    protected void maintain() {
        try {
            OsVersionStatus newStatus = OsVersionStatus.compute(controller());
            controller().updateOsVersionStatus(newStatus);
        } catch (Exception e) {
            log.log(Level.WARNING, "Failed to compute version status: " + Exceptions.toMessageString(e) +
                                      ". Retrying in " + maintenanceInterval());
        }
    }

}