use of com.iwave.ext.linux.command.version.GetSuSEVersionCommand in project coprhd-controller by CoprHD.
the class LinuxHostDiscoveryAdapter method getVersions.
protected List<LinuxVersion> getVersions(Host host) {
LinuxSystemCLI cli = createLinuxCLI(host);
List<LinuxVersion> versions = new ArrayList<LinuxVersion>();
LinuxVersionCommand[] commands = { new GetSuSEVersionCommand(), new GetRedhatVersionCommandOne(), new GetRedhatVersionCommandTwo(), new GetRedhatVersionCommandThree(), new GetLinuxVersionLSBReleaseCommand() };
for (LinuxVersionCommand command : commands) {
try {
cli.executeCommand(command);
LinuxVersion version = command.getResults();
if (version != null) {
versions.add(version);
}
} catch (CommandException e) {
warn("Could not retrieve linux version", e);
}
}
if (versions.isEmpty()) {
error("Could not determine version of linux host %s", host.getLabel());
versions.add(new LinuxVersion(LinuxDistribution.UNKNOWN, ""));
}
return versions;
}
Aggregations