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

Commit eb4949b

Browse files
committed
#255 Fixed ordering of deploying groups
And only updating group servers if the group was just created
1 parent 3bfc041 commit eb4949b

File tree

2 files changed

+26
-25
lines changed

2 files changed

+26
-25
lines changed

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

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,24 @@
22

33
public abstract class SortOrderConstants {
44

5-
public static Integer DEPLOY_GROUPS = 5;
6-
7-
public static Integer DEPLOY_PRIVILEGES = 10;
8-
public static Integer DEPLOY_ROLES = 20;
9-
public static Integer DEPLOY_USERS = 30;
10-
public static Integer DEPLOY_CERTIFICATE_TEMPLATES = 50;
11-
public static Integer GENERATE_TEMPORARY_CERTIFICATE = 55;
12-
public static Integer DEPLOY_CERTIFICATE_AUTHORITIES = 60;
13-
public static Integer DEPLOY_EXTERNAL_SECURITY = 70;
14-
public static Integer DEPLOY_PROTECTED_COLLECTIONS = 80;
15-
public static Integer DEPLOY_MIMETYPES = 90;
16-
public static Integer DEPLOY_PROTECTED_PATHS = 95;
17-
public static Integer DEPLOY_QUERY_ROLESETS = 97;
18-
5+
public static Integer DEPLOY_PRIVILEGES = 5;
6+
public static Integer DEPLOY_ROLES = 10;
7+
public static Integer DEPLOY_USERS = 15;
8+
public static Integer DEPLOY_CERTIFICATE_TEMPLATES = 20;
9+
public static Integer GENERATE_TEMPORARY_CERTIFICATE = 25;
10+
public static Integer DEPLOY_CERTIFICATE_AUTHORITIES = 30;
11+
public static Integer DEPLOY_EXTERNAL_SECURITY = 35;
12+
public static Integer DEPLOY_PROTECTED_COLLECTIONS = 40;
13+
public static Integer DEPLOY_MIMETYPES = 45;
14+
public static Integer DEPLOY_PROTECTED_PATHS = 50;
15+
public static Integer DEPLOY_QUERY_ROLESETS = 55;
16+
17+
public static Integer DEPLOY_GROUPS = 90;
18+
1919
// Hosts need to be assigned to their group before databases are created.
2020
// This is so that when forests are created based on the mlDatabaseGroups
2121
// then the forests will be created on the correct hosts.
22-
public static Integer ASSIGN_HOSTS_TO_GROUPS = 98;
22+
public static Integer ASSIGN_HOSTS_TO_GROUPS = 95;
2323

2424
public static Integer DEPLOY_TRIGGERS_DATABASE = 100;
2525
public static Integer DEPLOY_SCHEMAS_DATABASE = 100;
@@ -69,7 +69,10 @@ public abstract class SortOrderConstants {
6969

7070
public static Integer DEPLOY_FOREST_REPLICAS = 1200;
7171

72-
// Undo constants
72+
public static Integer DELETE_MIMETYPES = 8500;
73+
74+
public static Integer UNASSIGN_HOSTS_FROM_GROUPS = 8590;
75+
public static Integer DELETE_GROUPS = 8600;
7376

7477
public static Integer DELETE_USERS = 9000;
7578
public static Integer DELETE_CERTIFICATE_TEMPLATES = 9010;
@@ -83,10 +86,6 @@ public abstract class SortOrderConstants {
8386
// Protected paths reference roles
8487
public static Integer DELETE_PROTECTED_PATHS = 9080;
8588

86-
public static Integer DELETE_GROUPS = 8600;
87-
public static Integer UNASSIGN_HOSTS_FROM_GROUPS = 8590;
88-
89-
public static Integer DELETE_MIMETYPES = 8500;
9089

9190
/*
9291
* This executes before databases are deleted, as deleting databases normally deletes the primary forests, so we

src/main/java/com/marklogic/appdeployer/command/groups/DeployGroupsCommand.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,21 @@ protected void afterResourceSaved(ResourceManager mgr, CommandContext context, F
6161
}
6262
context.getAdminManager().waitForRestart();
6363
}
64+
}
6465

65-
// When new groups are created, an Admin server is automatically created in that group.
66-
// However, the Admin server's rewrite property is empty - causing problems with reading the timestamp
66+
if (receipt.hasLocationHeader()) {
67+
// When new groups are created, an Admin server is automatically created in that group.
68+
// However, the Admin server's rewrite property is empty - causing problems with reading the timestamp
6769
String groupName = new PayloadParser().getPayloadFieldValue(payload, "group-name", true);
6870
ServerManager serverMgr = new ServerManager(context.getManageClient(), groupName);
6971
if (fixAdminServerRewriter) {
70-
if (logger.isInfoEnabled()) {
71-
logger.info(format("Updating admin server in group %s to ensure that its url-rewriter is correct", groupName));
72+
if (logger.isInfoEnabled()) {
73+
logger.info(format("Updating admin server in group %s to ensure that its url-rewriter is correct", groupName));
7274
}
7375
serverMgr.save(adminServerTemplate.getJson());
7476
}
7577

76-
ensureGroupServersExist(serverMgr, groupName);
78+
ensureGroupServersExist(serverMgr, groupName);
7779
}
7880
}
7981

0 commit comments

Comments
 (0)