Skip to content

Commit

Permalink
fix(policies): change order of operations for policies bootstrap step…
Browse files Browse the repository at this point in the history
… to update index after database (#4841)
  • Loading branch information
RyanHolstien authored May 5, 2022
1 parent 50f9d3d commit e5a9a52
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ public void execute() throws IOException, URISyntaxException {
String.format("Found malformed policies file, expected an Array but found %s", policiesObj.getNodeType()));
}

// If search index for policies is empty, send MCLs for all policies to ingest policies into the search index
if (_entitySearchService.docCount(Constants.POLICY_ENTITY_NAME) == 0) {
updatePolicyIndex();
}

// 2. For each JSON object, cast into a DataHub Policy Info object.
for (final JsonNode policyObj : policiesObj) {
final Urn urn = Urn.createFromString(policyObj.get("urn").asText());
Expand Down Expand Up @@ -99,6 +94,11 @@ public void execute() throws IOException, URISyntaxException {
}
}
}
// If search index for policies is empty, update the policy index with the ingested policies from previous step.
// Directly update the ES index, does not produce MCLs
if (_entitySearchService.docCount(Constants.POLICY_ENTITY_NAME) == 0) {
updatePolicyIndex();
}
log.info("Successfully ingested default access policies.");
}

Expand Down

0 comments on commit e5a9a52

Please sign in to comment.