Browse code

Chore: Ensure sds-proxy re-reads bm-core.tok at install time

Thomas Cataldo authored on 28/10/2019 08:26:12
Showing 2 changed files
... ...
@@ -84,15 +84,26 @@ public class CyrusService {
84 84
 	}
85 85
 
86 86
 	public void reload() throws ServerFault {
87
-		logger.info("Attempting restart on " + backendAddress);
88
-		ExitList restartOp = NCUtils.exec(nodeClient, "service bm-cyrus-imapd restart", 90, TimeUnit.SECONDS);
89
-		if (restartOp.getExitCode() != 0) {
90
-			String output = restartOp.stream().collect(Collectors.joining("; "));
87
+		logger.info("Attempting cyrus restart on {}", backendAddress);
88
+
89
+		ExitList cyrusRestartOp = NCUtils.exec(nodeClient, "service bm-cyrus-imapd restart", 90, TimeUnit.SECONDS);
90
+		if (cyrusRestartOp.getExitCode() != 0) {
91
+			String output = cyrusRestartOp.stream().collect(Collectors.joining("; "));
91 92
 			throw new ServerFault("Cyrus restart failed (output: " + output + ")");
92 93
 		}
93 94
 		new NetworkHelper(backendAddress).waitForListeningPort(1143, 30, TimeUnit.SECONDS);
94 95
 	}
95 96
 
97
+	public void reloadSds() throws ServerFault {
98
+		logger.info("Attempting sds restart on {}", backendAddress);
99
+		ExitList sdsRestartOp = NCUtils.exec(nodeClient, "service bm-sds-proxy restart", 90, TimeUnit.SECONDS);
100
+		if (sdsRestartOp.getExitCode() != 0) {
101
+			String output = sdsRestartOp.stream().collect(Collectors.joining("; "));
102
+			throw new ServerFault("Sds restart failed (output: " + output + ")");
103
+		}
104
+		new NetworkHelper(backendAddress).waitForListeningPort(8091, 30, TimeUnit.SECONDS);
105
+	}
106
+
96 107
 	public CyrusPartition createPartition(String domainUid) throws ServerFault {
97 108
 		CyrusPartition cp = CyrusPartition.forServerAndDomain(backend, domainUid);
98 109
 		String partition = cp.name;
... ...
@@ -436,6 +436,7 @@ public class CyrusMailboxesStorage implements IMailboxesStorage {
436 436
 
437 437
 		CyrusService cyrus = new CyrusService(server.value.address());
438 438
 		cyrus.refreshPartitions(getMailImapDomains(context, server.uid));
439
+		cyrus.reloadSds();
439 440
 		cyrus.reload();
440 441
 	}
441 442