incorporate feedback
Original commit: elastic/x-pack-elasticsearch@f10ea80143
This commit is contained in:
parent
7e3fac9b35
commit
57544b8688
|
@ -394,11 +394,7 @@ public class LicensesService extends AbstractLifecycleComponent implements Clust
|
|||
@Override
|
||||
protected void doStart() throws ElasticsearchException {
|
||||
clusterService.add(this);
|
||||
try {
|
||||
scheduler.start(Collections.emptyList());
|
||||
} catch (Exception e) {
|
||||
logger.warn("failed to start license trigger service", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -433,17 +429,14 @@ public class LicensesService extends AbstractLifecycleComponent implements Clust
|
|||
logger.debug("current [{}]", currentLicensesMetaData);
|
||||
}
|
||||
// notify all interested plugins
|
||||
if (previousClusterState.blocks().hasGlobalBlock(GatewayService.STATE_NOT_RECOVERED_BLOCK)) {
|
||||
onUpdate(currentLicensesMetaData);
|
||||
} else {
|
||||
if (prevLicensesMetaData == null) {
|
||||
if (previousClusterState.blocks().hasGlobalBlock(GatewayService.STATE_NOT_RECOVERED_BLOCK)
|
||||
|| prevLicensesMetaData == null) {
|
||||
if (currentLicensesMetaData != null) {
|
||||
onUpdate(currentLicensesMetaData);
|
||||
}
|
||||
} else if (!prevLicensesMetaData.equals(currentLicensesMetaData)) {
|
||||
onUpdate(currentLicensesMetaData);
|
||||
}
|
||||
}
|
||||
// auto-generate license if no licenses ever existed
|
||||
// this will trigger a subsequent cluster changed event
|
||||
if (prevLicensesMetaData == null
|
||||
|
|
|
@ -109,10 +109,8 @@ public class LicensesManagerServiceTests extends ESSingleNodeTestCase {
|
|||
|
||||
// ensure that the invalid license never made it to cluster state
|
||||
LicensesMetaData licensesMetaData = clusterService.state().metaData().custom(LicensesMetaData.TYPE);
|
||||
if (licensesMetaData != null) {
|
||||
assertThat(licensesMetaData.getLicense(), not(equalTo(tamperedLicense)));
|
||||
}
|
||||
}
|
||||
|
||||
public void testRemoveLicenses() throws Exception {
|
||||
LicensesService licensesService = getInstanceFromNode(LicensesService.class);
|
||||
|
|
Loading…
Reference in New Issue