Skip to content

Commit 7face58

Browse files
Merge pull request #248 from wttech/repo-init-check
Repo init check
2 parents ffe8799 + 8fb9ab4 commit 7face58

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

core/src/main/java/dev/vml/es/acm/core/instance/HealthChecker.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import dev.vml.es.acm.core.osgi.OsgiScanner;
1010
import dev.vml.es.acm.core.osgi.OsgiUtils;
1111
import dev.vml.es.acm.core.repo.Repo;
12+
import dev.vml.es.acm.core.script.ScriptType;
1213
import dev.vml.es.acm.core.util.ExceptionUtils;
1314
import dev.vml.es.acm.core.util.ResolverUtils;
1415
import java.util.*;
@@ -18,7 +19,6 @@
1819
import org.apache.commons.lang3.StringUtils;
1920
import org.apache.sling.api.resource.ResourceResolver;
2021
import org.apache.sling.api.resource.ResourceResolverFactory;
21-
import org.apache.sling.discovery.DiscoveryService;
2222
import org.osgi.framework.Bundle;
2323
import org.osgi.framework.FrameworkUtil;
2424
import org.osgi.framework.ServiceRegistration;
@@ -53,9 +53,6 @@ public class HealthChecker implements EventHandler {
5353
@Reference
5454
private SlingInstaller slingInstaller;
5555

56-
@Reference
57-
private DiscoveryService discoveryService;
58-
5956
private Config config;
6057

6158
private ServiceRegistration<EventHandler> eventHandlerRegistration;
@@ -131,6 +128,14 @@ private void checkRepository(List<HealthIssue> issues, ResourceResolver resource
131128
"Composite node store not available",
132129
null));
133130
}
131+
if (Arrays.stream(ScriptType.values())
132+
.anyMatch(st -> !repo.get(st.root()).exists())) {
133+
issues.add(new HealthIssue(
134+
HealthIssueSeverity.CRITICAL,
135+
HealthIssueCategory.INSTANCE,
136+
"Restart required: repo-init not yet executed",
137+
null));
138+
}
134139
if (ArrayUtils.isNotEmpty(config.repositoryPathsExisted())) {
135140
Arrays.stream(config.repositoryPathsExisted()).forEach(path -> {
136141
if (!repo.get(path).exists()) {

0 commit comments

Comments
 (0)