use of io.vertx.core.cli.CLIException in project vert.x by eclipse.
the class RunCommand method setUp.
/**
* Validates the command line parameters.
*
* @param context - the execution context
* @throws CLIException - validation failed
*/
@Override
public void setUp(ExecutionContext context) throws CLIException {
super.setUp(context);
// If cluster-host and / or port is set, cluster need to have been explicitly set
io.vertx.core.cli.Option clusterHostOption = executionContext.cli().getOption("cluster-host");
io.vertx.core.cli.Option clusterPortOption = executionContext.cli().getOption("cluster-port");
CommandLine commandLine = executionContext.commandLine();
if ((!isClustered()) && (commandLine.isOptionAssigned(clusterHostOption) || commandLine.isOptionAssigned(clusterPortOption))) {
throw new CLIException("The option -cluster-host and -cluster-port requires -cluster to be enabled");
}
// If quorum and / or ha-group, ha need to have been explicitly set
io.vertx.core.cli.Option haGroupOption = executionContext.cli().getOption("hagroup");
io.vertx.core.cli.Option quorumOption = executionContext.cli().getOption("quorum");
if (!ha && (commandLine.isOptionAssigned(haGroupOption) || commandLine.isOptionAssigned(quorumOption))) {
throw new CLIException("The option -hagroup and -quorum requires -ha to be enabled");
}
}
Aggregations