Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ public void initialize(boolean shouldManage) {
return;
}

if (!NetworkUtils.nmcliIsInstalled()) {
logger.error("Cannot manage network without nmcli!");
this.networkingIsDisabled = true;
return;
}

// Start tasks to monitor the network interface(s)
var ethernetDevices = NetworkUtils.getAllWiredInterfaces();
for (NMDeviceInfo deviceInfo : ethernetDevices) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@ public NMDeviceInfo(String c, String d, String type) {
}
}

public static boolean nmcliIsInstalled() {
var shell = new ShellExec(true, false);
try {
shell.executeBashCommand("nmcli --version");

return shell.getExitCode() == 0;
} catch (IOException e) {
logger.error("Could not query nmcli version", e);
return false;
}
}

private static List<NMDeviceInfo> allInterfaces = new ArrayList<>();
private static long lastReadTimestamp = 0;

Expand Down
Loading