Search in sources :

Example 1 with GetRedhatVersionCommandThree

use of com.iwave.ext.linux.command.version.GetRedhatVersionCommandThree 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;
}
Also used : GetSuSEVersionCommand(com.iwave.ext.linux.command.version.GetSuSEVersionCommand) GetRedhatVersionCommandOne(com.iwave.ext.linux.command.version.GetRedhatVersionCommandOne) LinuxSystemCLI(com.iwave.ext.linux.LinuxSystemCLI) LinuxVersionCommand(com.iwave.ext.linux.command.version.LinuxVersionCommand) ArrayList(java.util.ArrayList) GetRedhatVersionCommandThree(com.iwave.ext.linux.command.version.GetRedhatVersionCommandThree) GetRedhatVersionCommandTwo(com.iwave.ext.linux.command.version.GetRedhatVersionCommandTwo) CommandException(com.iwave.ext.command.CommandException) LinuxVersion(com.iwave.ext.linux.model.LinuxVersion) GetLinuxVersionLSBReleaseCommand(com.iwave.ext.linux.command.version.GetLinuxVersionLSBReleaseCommand)

Aggregations

CommandException (com.iwave.ext.command.CommandException)1 LinuxSystemCLI (com.iwave.ext.linux.LinuxSystemCLI)1 GetLinuxVersionLSBReleaseCommand (com.iwave.ext.linux.command.version.GetLinuxVersionLSBReleaseCommand)1 GetRedhatVersionCommandOne (com.iwave.ext.linux.command.version.GetRedhatVersionCommandOne)1 GetRedhatVersionCommandThree (com.iwave.ext.linux.command.version.GetRedhatVersionCommandThree)1 GetRedhatVersionCommandTwo (com.iwave.ext.linux.command.version.GetRedhatVersionCommandTwo)1 GetSuSEVersionCommand (com.iwave.ext.linux.command.version.GetSuSEVersionCommand)1 LinuxVersionCommand (com.iwave.ext.linux.command.version.LinuxVersionCommand)1 LinuxVersion (com.iwave.ext.linux.model.LinuxVersion)1 ArrayList (java.util.ArrayList)1