Skip to content

Commit cd1b3a8

Browse files
committed
updated message IDs, minor code cleanup
1 parent 394fd6a commit cd1b3a8

File tree

3 files changed

+28
-48
lines changed

3 files changed

+28
-48
lines changed

src/main/java/oracle/kubernetes/operator/logging/MessageKeys.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,11 @@ private MessageKeys() {
139139
public static final String SERVER_SERVICE_DELETED = "WLSKO-0123";
140140
public static final String CLUSTER_SERVICE_DELETED = "WLSKO-0124";
141141
public static final String INGRESS_DELETED = "WLSKO-0125";
142-
public static final String WLS_UPDATE_CLUSTER_SIZE_STARTING = "WLSKO-0201";
143-
public static final String WLS_UPDATE_CLUSTER_SIZE_FAILED = "WLSKO-0202";
144-
public static final String WLS_UPDATE_CLUSTER_SIZE_TIMED_OUT = "WLSKO-0203";
145-
public static final String WLS_UPDATE_CLUSTER_SIZE_INVALID_CLUSTER = "WLSKO-0204";
146-
public static final String WLS_CLUSTER_SIZE_UPDATED = "WLSKO-0205";
147-
public static final String WLS_SERVER_TEMPLATE_NOT_FOUND = "WLSKO-0206";
148-
public static final String WLS_CREATING_MACHINE = "WLSKO-0207";
149-
public static final String WLS_EDIT_SESSION_STARTED = "WLSKO-0208";
150-
public static final String WLS_EDIT_SESSION_ACTIVATED = "WLSKO-0209";
151-
public static final String WLS_EDIT_SESSION_CANCELLED = "WLSKO-0210";
142+
public static final String WLS_UPDATE_CLUSTER_SIZE_STARTING = "WLSKO-0126";
143+
public static final String WLS_UPDATE_CLUSTER_SIZE_FAILED = "WLSKO-0127";
144+
public static final String WLS_UPDATE_CLUSTER_SIZE_TIMED_OUT = "WLSKO-0128";
145+
public static final String WLS_UPDATE_CLUSTER_SIZE_INVALID_CLUSTER = "WLSKO-0129";
146+
public static final String WLS_CLUSTER_SIZE_UPDATED = "WLSKO-0130";
147+
public static final String WLS_SERVER_TEMPLATE_NOT_FOUND = "WLSKO-0131";
148+
public static final String WLS_CREATING_MACHINE = "WLSKO-0132";
152149
}

src/main/java/oracle/kubernetes/operator/wlsconfig/WlsConfigRetriever.java

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -482,35 +482,21 @@ private static boolean updateDynamicClusterSizeWithServiceURL(final WlsClusterCo
482482
LOGGER.entering();
483483

484484
boolean result = false;
485-
try {
486-
// start a WebLogic edit session
487-
// httpClient.executePostUrlOnServiceClusterIP(START_EDIT_SESSION_URL, serviceURL, "");
488-
// LOGGER.info(MessageKeys.WLS_EDIT_SESSION_STARTED);
489-
490-
// Create machine(s)
491-
String newMachineNames[] = wlsClusterConfig.getMachineNamesForDynamicServers(machineNamePrefix, targetClusterSize);
492-
for (String machineName: newMachineNames) {
493-
LOGGER.info(MessageKeys.WLS_CREATING_MACHINE, machineName);
494-
httpClient.executePostUrlOnServiceClusterIP(WlsMachineConfig.getCreateUrl(),
495-
serviceURL, WlsMachineConfig.getCreatePayload(machineName), true);
496-
}
497-
498-
// Update the dynamic cluster size of the WebLogic cluster
499-
String jsonResult = httpClient.executePostUrlOnServiceClusterIP(
500-
wlsClusterConfig.getUpdateDynamicClusterSizeUrl(),
501-
serviceURL,
502-
wlsClusterConfig.getUpdateDynamicClusterSizePayload(targetClusterSize), true).getResponse();
503-
504-
// // activate the WebLogic edit session
505-
// httpClient.executePostUrlOnServiceClusterIP(ACTIVATE_EDIT_SESSION_URL, serviceURL, "", true);
506-
507-
result = wlsClusterConfig.checkUpdateDynamicClusterSizeJsonResult(jsonResult);
508-
// LOGGER.info(MessageKeys.WLS_EDIT_SESSION_ACTIVATED);
509-
} catch (HTTPException httpException) {
510-
// cancel the WebLogic edit session
511-
// httpClient.executePostUrlOnServiceClusterIP(CANCEL_EDIT_SESSION_URL, serviceURL, "");
512-
// LOGGER.info(MessageKeys.WLS_EDIT_SESSION_CANCELLED);
485+
// Create machine(s)
486+
String newMachineNames[] = wlsClusterConfig.getMachineNamesForDynamicServers(machineNamePrefix, targetClusterSize);
487+
for (String machineName: newMachineNames) {
488+
LOGGER.info(MessageKeys.WLS_CREATING_MACHINE, machineName);
489+
httpClient.executePostUrlOnServiceClusterIP(WlsMachineConfig.getCreateUrl(),
490+
serviceURL, WlsMachineConfig.getCreatePayload(machineName));
513491
}
492+
493+
// Update the dynamic cluster size of the WebLogic cluster
494+
String jsonResult = httpClient.executePostUrlOnServiceClusterIP(
495+
wlsClusterConfig.getUpdateDynamicClusterSizeUrl(),
496+
serviceURL,
497+
wlsClusterConfig.getUpdateDynamicClusterSizePayload(targetClusterSize)).getResponse();
498+
499+
result = wlsClusterConfig.checkUpdateDynamicClusterSizeJsonResult(jsonResult);
514500
LOGGER.exiting(result);
515501
return result;
516502
}

src/main/resources/Operator.properties

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,10 @@ WLSKO-0122=Pod for domain with domainUID {0} in namespace {1} and with server na
124124
WLSKO-0123=Service for domain with domainUID {0} in namespace {1} and with server name {2} deleted; validating domain
125125
WLSKO-0124=Service for domain with domainUID {0} in namespace {1} and with cluster name {2} deleted; validating domain
126126
WLSKO-0125=Ingress for domain with domainUID {0} in namespace {1} and with cluster name {2} deleted; validating domain
127-
WLSKO-0201=Updating cluster size for WebLogic dynamic cluster {0} to {1}
128-
WLSKO-0202=Failed to update WebLogic dynamic cluster size for cluster {0} due to exception: {1}
129-
WLSKO-0203=Failed to update WebLogic dynamic cluster size for cluster {0} within timeout of {1} milliseconds
130-
WLSKO-0204=Failed to update WebLogic dynamic cluster size for cluster {0}. Cluster is not a dynamic cluster
131-
WLSKO-0205=Updated cluster size for WebLogic dynamic cluster {0} to {1}. Time taken {2} ms
132-
WLSKO-0206=Cannot find WebLogic server template with name {0} which is referenced by WebLogic cluster {1}
133-
WLSKO-0207=Creating WebLogic machine named {0}
134-
WLSKO-0208=WebLogic edit session started
135-
WLSKO-0209=WebLogic edit session activated
136-
WLSKO-0210=WebLogic edit session cancelled
127+
WLSKO-0126=Updating cluster size for WebLogic dynamic cluster {0} to {1}
128+
WLSKO-0127=Failed to update WebLogic dynamic cluster size for cluster {0} due to exception: {1}
129+
WLSKO-0128=Failed to update WebLogic dynamic cluster size for cluster {0} within timeout of {1} milliseconds
130+
WLSKO-0129=Failed to update WebLogic dynamic cluster size for cluster {0}. Cluster is not a dynamic cluster
131+
WLSKO-0130=Updated cluster size for WebLogic dynamic cluster {0} to {1}. Time taken {2} ms
132+
WLSKO-0131=Cannot find WebLogic server template with name {0} which is referenced by WebLogic cluster {1}
133+
WLSKO-0132=Creating WebLogic machine named {0}

0 commit comments

Comments
 (0)