(CommandLine cli)
| 70 | } |
| 71 | |
| 72 | @Override |
| 73 | public void runImpl(CommandLine cli) throws Exception { |
| 74 | |
| 75 | String propertyName = cli.getOptionValue(PROPERTY_OPTION); |
| 76 | String propertyValue = cli.getOptionValue(VALUE_OPTION); |
| 77 | String zkHost = CLIUtils.getZkHost(cli); |
| 78 | |
| 79 | if (!ZkController.checkChrootPath(zkHost, true)) { |
| 80 | throw new IllegalStateException( |
| 81 | "A chroot was specified in zkHost but the znode doesn't exist."); |
| 82 | } |
| 83 | |
| 84 | try (SolrZkClient zkClient = |
| 85 | new SolrZkClient.Builder() |
| 86 | .withUrl(zkHost) |
| 87 | .withTimeout(SolrZkClientTimeout.DEFAULT_ZK_CLIENT_TIMEOUT, TimeUnit.MILLISECONDS) |
| 88 | .build()) { |
| 89 | |
| 90 | ClusterProperties props = new ClusterProperties(zkClient); |
| 91 | try { |
| 92 | props.setClusterProperty(propertyName, propertyValue); |
| 93 | } catch (IOException ex) { |
| 94 | throw new Exception( |
| 95 | "Unable to set the cluster property due to following error : " |
| 96 | + ex.getLocalizedMessage()); |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | } |
nothing calls this directly
no test coverage detected