throw new ParseException("could not parse " + HOST_OP + " option");
}
} else {
hostName = hostNameEntered;
}
final HostOptions ho = new HostOptions(hostName);
if (port != null) {
ho.setPort(port);
}
hostsOptions.add(ho);
clusters.get(clusterName).add(ho);
}
} else if (SUDO_OP.equals(op)) {
if (hostsOptions == null) {
throw new ParseException(SUDO_OP + " must be defined after " + HOST_OP);
}
for (final HostOptions ho : hostsOptions) {
ho.setUseSudo(true);
}
} else if (USER_OP.equals(op)) {
if (hostsOptions == null) {
throw new ParseException(USER_OP + " must be defined after " + HOST_OP);
}
final String userName = option.getValue();
if (userName == null) {
throw new ParseException("could not parse " + USER_OP + " option");
}
for (final HostOptions ho : hostsOptions) {
ho.setLoginUser(userName);
}
} else if (PORT_OP.equals(op)) {
if (hostsOptions == null) {
throw new ParseException(PORT_OP + " must be defined after " + HOST_OP);
}
final String port = option.getValue();
if (port == null) {
throw new ParseException("could not parse " + PORT_OP + " option");
}
for (final HostOptions ho : hostsOptions) {
ho.setPort(port);
}
} else if (PCMKTEST_OP.equals(op)) {
final String index = option.getValue();
if (index != null && !index.isEmpty()) {
application.setAutoTest(new Test(StartTests.Type.PCMK, index.charAt(0)));