diff options
author | valerijf <valerijf@oath.com> | 2017-09-05 18:44:36 +0200 |
---|---|---|
committer | valerijf <valerijf@oath.com> | 2017-09-05 18:44:36 +0200 |
commit | 93d49f767f0b26e5f680c088e7421bc732e94d15 (patch) | |
tree | 68ced08a8fa57937f7c8410f2c8ee53bb3f93cb3 | |
parent | 21999f65ec4c436925201b77e80db6eadfd1ca2f (diff) |
Use os.version instead of uname -r
-rw-r--r-- | node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/StorageMaintainer.java | 22 |
1 files changed, 1 insertions, 21 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 73b83091746..2450759a5c2 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 @@ -47,7 +47,6 @@ import static com.yahoo.vespa.defaults.Defaults.getDefaults; public class StorageMaintainer { private static final ContainerName NODE_ADMIN = new ContainerName("node-admin"); private static final ObjectMapper objectMapper = new ObjectMapper(); - private static Optional<String> kernelVersion = Optional.empty(); private final CounterWrapper numberOfNodeAdminMaintenanceFails; private final Docker docker; @@ -231,11 +230,7 @@ public class StorageMaintainer { attributes.put("region", environment.getRegion()); attributes.put("environment", environment.getEnvironment()); attributes.put("flavor", nodeSpec.nodeFlavor); - try { - attributes.put("kernel_version", getKernelVersion()); - } catch (Throwable ignored) { - attributes.put("kernel_version", "unknown"); - } + attributes.put("kernel_version", System.getProperty("os.version")); nodeSpec.currentDockerImage.ifPresent(image -> attributes.put("docker_image", image.asString())); nodeSpec.vespaVersion.ifPresent(version -> attributes.put("vespa_version", version)); @@ -322,21 +317,6 @@ public class StorageMaintainer { } - - private String getKernelVersion() throws IOException, InterruptedException { - if (! kernelVersion.isPresent()) { - Pair<Integer, String> result = new ProcessExecuter().exec(new String[]{"uname", "-r"}); - if (result.getFirst() == 0) { - kernelVersion = Optional.of(result.getSecond().trim()); - } else { - throw new RuntimeException("Failed to get kernel version\n" + result); - } - } - - return kernelVersion.orElse("unknown"); - } - - private String executeMaintainer(String mainClass, String... args) { String[] command = Stream.concat( Stream.of("sudo", "-E", getDefaults().underVespaHome("libexec/vespa/node-admin/maintenance.sh"), mainClass), |