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,10 +125,9 @@ 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 { return ClusterState.builder(currentState).metaData(mdBuilder).build();
mdBuilder.putCustom(LicensesMetaData.TYPE, currentLicenses);
} }
return ClusterState.builder(currentState).metaData(mdBuilder).build(); return currentState;
} }
}); });
} else { } else {
@ -284,10 +283,9 @@ 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 { return ClusterState.builder(currentState).metaData(mdBuilder).build();
mdBuilder.putCustom(LicensesMetaData.TYPE, currentLicensesMetaData);
} }
return ClusterState.builder(currentState).metaData(mdBuilder).build(); return currentState;
} }
@Override @Override