Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit 67b3092

Browse files
authored
Merge pull request #443 from marklogic-community/feature/442-ignore
442 Log warning instead of throwing error when database directory isn't associated to a real database
2 parents b7b9e8a + 53b83e9 commit 67b3092

File tree

16 files changed

+61
-16
lines changed

16 files changed

+61
-16
lines changed

src/main/java/com/marklogic/appdeployer/command/AbstractCommand.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,10 @@ protected void setIncrementalMode(boolean incrementalMode) {
509509
* within the directory should be associated with. But starting in 3.16.0, if the name of the directory doesn't
510510
* match that of an existing database, then a check is made to see if there's a database file in the given ConfigDir
511511
* that has the same name, minus its extension, as the database directory name. If so, then the database-name is
512-
* extracted from that file and used as the database name. If not, an exception is thrown.
512+
* extracted from that file and used as the database name. If not, a warning is logged and null is returned.
513+
* Previously, an exception was thrown if the database-name could not be determined, but this raised problems for
514+
* users that had directory names like ".svn" that they could not easily remove (and we can't eagerly ignore certain
515+
* names since something like ".svn" is a valid ML database name).
513516
*
514517
* @param context
515518
* @param configDir
@@ -538,8 +541,10 @@ protected String determineDatabaseNameForDatabaseResourceDirectory(CommandContex
538541
}
539542
}
540543

541-
throw new RuntimeException("Could not determine database to associate with database resource directory: " +
542-
databaseResourceDir);
544+
logger.warn("Could not determine database to associate with database resource directory: " +
545+
databaseResourceDir + "; will not process any resource files in that directory");
546+
547+
return null;
543548
}
544549

545550
public void setPayloadTokenReplacer(PayloadTokenReplacer payloadTokenReplacer) {

src/main/java/com/marklogic/appdeployer/command/alert/DeployAlertActionsCommand.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ public void execute(CommandContext context) {
3535
deployActions(context, configDir, appConfig.getContentDatabaseName());
3636
for (File dir : configDir.getDatabaseResourceDirectories()) {
3737
String databaseName = determineDatabaseNameForDatabaseResourceDirectory(context, configDir, dir);
38-
deployActions(context, new ConfigDir(dir), databaseName);
38+
if (databaseName != null) {
39+
deployActions(context, new ConfigDir(dir), databaseName);
40+
}
3941
}
4042
}
4143
}

src/main/java/com/marklogic/appdeployer/command/alert/DeployAlertConfigsCommand.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ public void execute(CommandContext context) {
2626
deployAlertConfigs(context, configDir, appConfig.getContentDatabaseName());
2727
for (File dir : configDir.getDatabaseResourceDirectories()) {
2828
String databaseName = determineDatabaseNameForDatabaseResourceDirectory(context, configDir, dir);
29-
deployAlertConfigs(context, new ConfigDir(dir), databaseName);
29+
if (databaseName != null) {
30+
deployAlertConfigs(context, new ConfigDir(dir), databaseName);
31+
}
3032
}
3133
}
3234
}

src/main/java/com/marklogic/appdeployer/command/alert/DeployAlertRulesCommand.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ public void execute(CommandContext context) {
2828
deployRules(context, configDir, appConfig.getContentDatabaseName());
2929
for (File dir : configDir.getDatabaseResourceDirectories()) {
3030
String databaseName = determineDatabaseNameForDatabaseResourceDirectory(context, configDir, dir);
31-
deployRules(context, new ConfigDir(dir), databaseName);
31+
if (databaseName != null) {
32+
deployRules(context, new ConfigDir(dir), databaseName);
33+
}
3234
}
3335
}
3436
}

src/main/java/com/marklogic/appdeployer/command/flexrep/DeployConfigsCommand.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ public void execute(CommandContext context) {
3333
deployConfigs(context, configDir, appConfig.getContentDatabaseName());
3434
for (File dir : configDir.getDatabaseResourceDirectories()) {
3535
String databaseName = determineDatabaseNameForDatabaseResourceDirectory(context, configDir, dir);
36-
deployConfigs(context, new ConfigDir(dir), databaseName);
36+
if (databaseName != null) {
37+
deployConfigs(context, new ConfigDir(dir), databaseName);
38+
}
3739
}
3840
}
3941
}

src/main/java/com/marklogic/appdeployer/command/flexrep/DeployPullsCommand.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ public void execute(CommandContext context) {
3535
deployFlexRepPulls(context, configDir, appConfig.getContentDatabaseName());
3636
for (File dir : configDir.getDatabaseResourceDirectories()) {
3737
String databaseName = determineDatabaseNameForDatabaseResourceDirectory(context, configDir, dir);
38-
deployFlexRepPulls(context, new ConfigDir(dir), databaseName);
38+
if (databaseName != null) {
39+
deployFlexRepPulls(context, new ConfigDir(dir), databaseName);
40+
}
3941
}
4042
}
4143
}

src/main/java/com/marklogic/appdeployer/command/flexrep/DeployTargetsCommand.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ public void execute(CommandContext context) {
3737
deployTargets(context, configDir, appConfig.getContentDatabaseName());
3838
for (File dir : configDir.getDatabaseResourceDirectories()) {
3939
String databaseName = determineDatabaseNameForDatabaseResourceDirectory(context, configDir, dir);
40-
deployTargets(context, new ConfigDir(dir), databaseName);
40+
if (databaseName != null) {
41+
deployTargets(context, new ConfigDir(dir), databaseName);
42+
}
4143
}
4244
}
4345
}

src/main/java/com/marklogic/appdeployer/command/rebalancer/DeployPartitionQueriesCommand.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ public void execute(CommandContext context) {
2727
for (ConfigDir configDir : appConfig.getConfigDirs()) {
2828
for (File dir : configDir.getDatabaseResourceDirectories()) {
2929
String databaseName = determineDatabaseNameForDatabaseResourceDirectory(context, configDir, dir);
30-
deployPartitionQueries(context, new ConfigDir(dir), databaseName);
30+
if (databaseName != null) {
31+
deployPartitionQueries(context, new ConfigDir(dir), databaseName);
32+
}
3133
}
3234
}
3335
}

src/main/java/com/marklogic/appdeployer/command/rebalancer/DeployPartitionsCommand.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ public void execute(CommandContext context) {
2727
for (ConfigDir configDir : appConfig.getConfigDirs()) {
2828
for (File dir : configDir.getDatabaseResourceDirectories()) {
2929
String databaseName = determineDatabaseNameForDatabaseResourceDirectory(context, configDir, dir);
30-
deployPartitions(context, new ConfigDir(dir), databaseName);
30+
if (databaseName != null) {
31+
deployPartitions(context, new ConfigDir(dir), databaseName);
32+
}
3133
}
3234
}
3335
}

src/main/java/com/marklogic/appdeployer/command/temporal/DeployTemporalAxesCommand.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ public void execute(CommandContext context) {
2828
deployTemporalAxes(context, configDir, appConfig.getContentDatabaseName());
2929
for (File dir : configDir.getDatabaseResourceDirectories()) {
3030
String databaseName = determineDatabaseNameForDatabaseResourceDirectory(context, configDir, dir);
31-
deployTemporalAxes(context, new ConfigDir(dir), databaseName);
31+
if (databaseName != null) {
32+
deployTemporalAxes(context, new ConfigDir(dir), databaseName);
33+
}
3234
}
3335
}
3436
}

0 commit comments

Comments
 (0)