Skip to content

Commit 5e83acf

Browse files
authored
Bugfix/dhfprod DHFPROD-1307, DHFPROD-1400, DHFPROD-1263 (#1476)
* DHFPROD-1307: PreInstallCheck task displays readable status * DHFPROD-1400: Fixed DHF isInstalled checks in gradle command * Restore the original logic, to execute through tests
1 parent 4fefc04 commit 5e83acf

File tree

6 files changed

+20
-15
lines changed

6 files changed

+20
-15
lines changed

marklogic-data-hub/src/main/java/com/marklogic/hub/impl/DataHubImpl.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ public class DataHubImpl implements DataHub {
7373
private AdminManager _adminManager;
7474

7575
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
76-
private String finalFile = "final-database.json";
77-
private String stagingFile = "staging-database.json";
78-
private String jobsFile = "job-database.json";
76+
private String finalFile = "final-database.json";
77+
private String stagingFile = "staging-database.json";
78+
private String jobsFile = "job-database.json";
7979

8080
public DataHubImpl(HubConfig hubConfig) {
8181
if (hubConfig == null) {
@@ -131,10 +131,9 @@ public InstallInfo isInstalled() {
131131

132132
InstallInfo installInfo = InstallInfo.create();
133133

134-
if (hubConfig.getIsProvisionedEnvironment()){
134+
if (hubConfig.getIsProvisionedEnvironment()) {
135135
return assumedProvisionedInstallInfo(installInfo);
136-
}
137-
else {
136+
} else {
138137
ResourcesFragment srf = null;
139138
try {
140139
srf = getServerManager().getAsXml();
@@ -405,7 +404,6 @@ public HashMap<String, Boolean> runPreInstallCheck(Versions versions) {
405404
}
406405

407406
Set<Integer> ports = portsInUse.keySet();
408-
409407
String serverName = portsInUse.get(hubConfig.getPort(DatabaseKind.STAGING));
410408
stagingPortInUse = ports.contains(hubConfig.getPort(DatabaseKind.STAGING)) && serverName != null && !serverName.equals(hubConfig.getHttpName(DatabaseKind.STAGING));
411409
if (stagingPortInUse) {
@@ -440,7 +438,9 @@ public HashMap<String, Boolean> runPreInstallCheck(Versions versions) {
440438
response.put("jobPortInUse", jobPortInUse);
441439
response.put("jobPortInUseBy", jobPortInUseBy);
442440
response.put("safeToInstall", isSafeToInstall());
443-
441+
if ((boolean) response.get("safeToInstall")) {
442+
response.put("dhfVersion", versions.getHubVersion());
443+
}
444444
return response;
445445
}
446446

@@ -527,9 +527,9 @@ public void installStaging(HubDeployStatusListener listener) {
527527

528528
@Override
529529
public void updateIndexes() {
530-
HubAppDeployer deployer = new HubAppDeployer(getManageClient(), getAdminManager(), null, hubConfig.newStagingClient());
530+
HubAppDeployer deployer = new HubAppDeployer(getManageClient(), getAdminManager(), null, hubConfig.newStagingClient());
531531

532-
AppConfig finalConfig = hubConfig.getFinalAppConfig();
532+
AppConfig finalConfig = hubConfig.getFinalAppConfig();
533533
List<Command> finalDBCommand = new ArrayList<>();
534534
finalDBCommand.add(new DeployHubDatabaseCommand(hubConfig, finalFile));
535535
deployer.setFinalCommandsList(finalDBCommand);

ml-data-hub-plugin/src/main/groovy/com/marklogic/gradle/task/DeleteJobsTask.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class DeleteJobsTask extends HubTask {
3939
println("Deleting jobs: " + jobIds)
4040
def jobManager = getJobManager()
4141
def dh = getDataHub()
42-
if (!dh.isInstalled()) {
42+
if (!isHubInstalled()) {
4343
println("Data Hub is not installed.")
4444
return
4545
}

ml-data-hub-plugin/src/main/groovy/com/marklogic/gradle/task/DeployUserModulesTask.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class DeployUserModulesTask extends HubTask {
2626
@TaskAction
2727
void deployUserModules() {
2828
def dh = getDataHub()
29-
if (!dh.isInstalled()) {
29+
if (!isHubInstalled()) {
3030
println("Data Hub is not installed.")
3131
return
3232
}

ml-data-hub-plugin/src/main/groovy/com/marklogic/gradle/task/ExportJobsTask.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class ExportJobsTask extends HubTask {
4646

4747
def jobManager = getJobManager()
4848
def dh = getDataHub()
49-
if (!dh.isInstalled()) {
49+
if (!isHubInstalled()) {
5050
println("Data Hub is not installed.")
5151
return
5252
}

ml-data-hub-plugin/src/main/groovy/com/marklogic/gradle/task/ImportJobsTask.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class ImportJobsTask extends HubTask {
3333

3434
def jobManager = getJobManager()
3535
def dh = getDataHub()
36-
if (!dh.isInstalled()) {
36+
if (!isHubInstalled()) {
3737
println("Data Hub is not installed.")
3838
return
3939
}

ml-data-hub-plugin/src/main/groovy/com/marklogic/gradle/task/PreinstallCheckTask.groovy

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ class PreinstallCheckTask extends HubTask {
5555

5656
throw new TaskExecutionException(this, new Throwable(sb.toString()))
5757
}
58-
print(dh.toString())
58+
59+
if(preInstallCheck.get("safeToInstall")) {
60+
print("DHF is not installed. Run mlDeploy task to install DHF")
61+
} else {
62+
print("DHF Version: " + preInstallCheck.get("dhfVersion") + " is installed")
63+
}
5964
}
6065
}

0 commit comments

Comments
 (0)