Skip to content

Commit 62d527a

Browse files
authored
temporary workaround to skip ADR patch if recommended for WLS (#200)
1 parent cc9ccc6 commit 62d527a

File tree

4 files changed

+46
-3
lines changed

4 files changed

+46
-3
lines changed

imagetool/src/main/java/com/oracle/weblogic/imagetool/cli/menu/CommonOptions.java

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,13 @@ void handlePatchFiles(FmwInstallerType installerType, String previousInventory,
254254

255255
if (patchList.isEmpty()) {
256256
recommendedPatches = false;
257-
logger.fine("Latest PSU and recommended patches NOT FOUND, ignoring recommendedPatches flag");
257+
logger.info("IMG-0084", getInstallerVersion());
258258
} else {
259259
for (String patchId: patchList) {
260-
logger.fine("Add latest recommended patch {0} to list", patchId);
261-
patchFiles.add(new PatchFile(patchId, getInstallerVersion(), psuVersion, userId, password));
260+
if (isOkToApply(installerType, patchId)) {
261+
logger.fine("Add latest recommended patch {0} to list", patchId);
262+
patchFiles.add(new PatchFile(patchId, getInstallerVersion(), psuVersion, userId, password));
263+
}
262264
}
263265
}
264266
} else if (latestPSU) {
@@ -307,6 +309,24 @@ void handlePatchFiles(FmwInstallerType installerType, String previousInventory,
307309
logger.exiting();
308310
}
309311

312+
/**
313+
* Returns false if the patch ID needs to be omitted/skipped and should not be applied.
314+
* @param installerType FMW installer type
315+
* @param patchId patch number
316+
* @return true if the patch should be applied
317+
*/
318+
static boolean isOkToApply(FmwInstallerType installerType, String patchId) {
319+
if (Utils.isEmptyString(patchId)) {
320+
return false;
321+
}
322+
if (FmwInstallerType.getWeblogicServerTypes().contains(installerType)
323+
&& patchId.startsWith("31544353")) {
324+
logger.info("IMG-0083", patchId);
325+
return false;
326+
}
327+
return true;
328+
}
329+
310330
private Path createPatchesTempDirectory() throws IOException {
311331
Path tmpPatchesDir = Files.createDirectory(Paths.get(getTempDirectory(), "patches"));
312332
Files.createFile(Paths.get(tmpPatchesDir.toAbsolutePath().toString(), "dummy.txt"));

imagetool/src/main/java/com/oracle/weblogic/imagetool/installer/FmwInstallerType.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,14 @@ public static FmwInstallerType fromValue(String value) {
9898
}
9999
throw new IllegalArgumentException(Utils.getMessage("IMG-0080", value));
100100
}
101+
102+
private static final List<FmwInstallerType> weblogicServerTypes = Arrays.asList(WLS, WLSDEV, WLSSLIM);
103+
104+
/**
105+
* Return a list of all WebLogic Server types (not JRF types).
106+
* @return list of WLS enum types.
107+
*/
108+
public static List<FmwInstallerType> getWeblogicServerTypes() {
109+
return weblogicServerTypes;
110+
}
101111
}

imagetool/src/main/resources/ImageTool.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,5 @@ IMG-0079=OS Package Manager override, changed from {0} to {1}
8181
IMG-0080=Argument {0} does not match any FmwInstallerType names
8282
IMG-0081=Unable to retrieve list of Oracle releases from Oracle Updates (ARU). Try again later.
8383
IMG-0082=Failed to determine release number for product {0}, version {1}
84+
IMG-0083=Recommended ADR patch was skipped for WLS installer, use --patch {0} to apply this patch
85+
IMG-0084=No recommended patches found for {0}

imagetool/src/test/java/com/oracle/weblogic/imagetool/cli/menu/CommonOptionsTest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import java.util.stream.Stream;
1919

2020
import com.oracle.weblogic.imagetool.api.model.CachedFile;
21+
import com.oracle.weblogic.imagetool.installer.FmwInstallerType;
2122
import com.oracle.weblogic.imagetool.logging.LoggingFacade;
2223
import com.oracle.weblogic.imagetool.logging.LoggingFactory;
2324
import com.oracle.weblogic.imagetool.util.DockerfileOptions;
@@ -27,6 +28,7 @@
2728
import org.junit.jupiter.api.io.TempDir;
2829

2930
import static org.junit.jupiter.api.Assertions.assertEquals;
31+
import static org.junit.jupiter.api.Assertions.assertFalse;
3032
import static org.junit.jupiter.api.Assertions.assertTrue;
3133
import static org.junit.jupiter.api.Assertions.fail;
3234

@@ -172,4 +174,13 @@ void testResolveOptions() throws Exception {
172174

173175
}
174176
}
177+
178+
@Test
179+
void testSkipAdrPatch() {
180+
assertFalse(CommonOptions.isOkToApply(FmwInstallerType.WLS, "31544353"));
181+
assertFalse(CommonOptions.isOkToApply(FmwInstallerType.WLS, "31544353_12.2.1.4.0"));
182+
assertFalse(CommonOptions.isOkToApply(FmwInstallerType.WLSSLIM, "31544353"));
183+
assertTrue(CommonOptions.isOkToApply(FmwInstallerType.FMW, "31544353"));
184+
assertTrue(CommonOptions.isOkToApply(FmwInstallerType.FMW, "31544353_12.2.1.3.0"));
185+
}
175186
}

0 commit comments

Comments
 (0)