registerLicenses/trialLicenses should return currentCLusterState if not modified

Original commit: elastic/x-pack-elasticsearch@b8432ed988
This commit is contained in:
Areek Zillur 2014-10-30 17:45:57 -04:00
parent 1b9f069837
commit 34679d3e47
1 changed files with 4 additions and 6 deletions

View File

@ -125,11 +125,10 @@ public class LicensesService extends AbstractLifecycleComponent<LicensesService>
if (newLicenseSignatures.size() != licensesWrapper.signatures.size()) { if (newLicenseSignatures.size() != licensesWrapper.signatures.size()) {
LicensesMetaData newLicensesMetaData = new LicensesMetaData(newLicenseSignatures, licensesWrapper.encodedTrialLicenses); LicensesMetaData newLicensesMetaData = new LicensesMetaData(newLicenseSignatures, licensesWrapper.encodedTrialLicenses);
mdBuilder.putCustom(LicensesMetaData.TYPE, newLicensesMetaData); mdBuilder.putCustom(LicensesMetaData.TYPE, newLicensesMetaData);
} else {
mdBuilder.putCustom(LicensesMetaData.TYPE, currentLicenses);
}
return ClusterState.builder(currentState).metaData(mdBuilder).build(); return ClusterState.builder(currentState).metaData(mdBuilder).build();
} }
return currentState;
}
}); });
} else { } else {
listener.onResponse(new LicensesUpdateResponse(true, status)); listener.onResponse(new LicensesUpdateResponse(true, status));
@ -284,11 +283,10 @@ public class LicensesService extends AbstractLifecycleComponent<LicensesService>
final LicensesMetaData newLicensesMetaData = new LicensesMetaData( final LicensesMetaData newLicensesMetaData = new LicensesMetaData(
licensesWrapper.signatures, newTrialLicenses); licensesWrapper.signatures, newTrialLicenses);
mdBuilder.putCustom(LicensesMetaData.TYPE, newLicensesMetaData); mdBuilder.putCustom(LicensesMetaData.TYPE, newLicensesMetaData);
} else {
mdBuilder.putCustom(LicensesMetaData.TYPE, currentLicensesMetaData);
}
return ClusterState.builder(currentState).metaData(mdBuilder).build(); return ClusterState.builder(currentState).metaData(mdBuilder).build();
} }
return currentState;
}
@Override @Override
public void onFailure(String source, @Nullable Throwable t) { public void onFailure(String source, @Nullable Throwable t) {