linstor: use relative hostname path (#8633)

As described in issue #8310 some older distributions don't have
hostname in /usr/bin so rely on PATH resolving
This commit is contained in:
Rene Peinthor 2024-02-09 11:49:20 +01:00 committed by GitHub
parent 2729ee110e
commit 393f3d7727
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -72,7 +72,7 @@ public class LinstorStorageAdaptor implements StorageAdaptor {
private String getHostname() {
// either there is already some function for that in the agent or a better way.
ProcessBuilder pb = new ProcessBuilder("/usr/bin/hostname");
ProcessBuilder pb = new ProcessBuilder("hostname");
try
{
String result;
@ -88,7 +88,7 @@ public class LinstorStorageAdaptor implements StorageAdaptor {
return result.trim();
} catch (IOException | InterruptedException exc) {
Thread.currentThread().interrupt();
throw new CloudRuntimeException("Unable to run '/usr/bin/hostname' command.");
throw new CloudRuntimeException("Unable to run 'hostname' command.");
}
}