Skip to content

Commit a8cd71a

Browse files
authored
Allow non-patching operations on images with unidentified products (#293)
* Allow non-patching operations on images where the installed products cannot be identified through the registry.xml
1 parent 2a41608 commit a8cd71a

File tree

5 files changed

+22
-4
lines changed

5 files changed

+22
-4
lines changed

imagetool/src/main/java/com/oracle/weblogic/imagetool/aru/AruUtil.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ List<AruPatch> getLatestPsu(AruProduct product, String version, String userId, S
105105
logger.exiting();
106106
return Collections.emptyList();
107107
} catch (IOException | XPathExpressionException e) {
108-
throw new AruException(Utils.getMessage("IMG-0032", product.description(), version), e);
108+
AruException aruE = new AruException(Utils.getMessage("IMG-0032", product.description(), version), e);
109+
logger.throwing(aruE);
110+
throw aruE;
109111
}
110112
}
111113

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,17 @@ public CommandResponse call() throws Exception {
143143

144144
FmwInstallerType installerType = FmwInstallerType.fromProductList(
145145
baseImageProperties.getProperty("oracleInstalledProducts"));
146-
logger.info("IMG-0094", installerType);
147-
// resolve required patches
148-
handlePatchFiles(installerType, installedPatches);
146+
if (installerType == null) {
147+
logger.fine("Unable to detect installed products from image {0}", fromImage);
148+
// This error occurred with the 12.2.1.4 quick slim image because registry.xml was missing data
149+
if (applyingPatches()) {
150+
return new CommandResponse(1, "IMG-0096", fromImage);
151+
}
152+
} else {
153+
logger.info("IMG-0094", installerType);
154+
// resolve required patches
155+
handlePatchFiles(installerType, installedPatches);
156+
}
149157

150158
// create dockerfile
151159
String dockerfile = Utils.writeDockerfile(tmpDir + File.separator + "Dockerfile",

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ public static boolean isBaseWeblogicServer(FmwInstallerType value) {
131131
*/
132132
public static FmwInstallerType fromProductList(String products) {
133133
logger.entering(products);
134+
if (Utils.isEmptyString(products)) {
135+
return null;
136+
}
137+
134138
// create a set from the comma-separated list
135139
Set<AruProduct> productSet = Stream.of(products.split(","))
136140
.filter(e -> !"TOPLINK".equals(e)) // skip TOPLINK product (WLS always contains TOPLINK)

imagetool/src/main/resources/ImageTool.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,4 @@ IMG-0092=ORACLE_HOME already exists in {0} (--fromImage), skipping middleware in
9494
IMG-0093=Patching skipped. Using CREATE to patch --fromImage with an existing ORACLE_HOME is not supported. To create a patched image, use CREATE with a linux base image and apply the WebLogic install and patches at the same time.
9595
IMG-0094=Source image installer type: ([[green: {0}]])
9696
IMG-0095=Unable to parse response for Oracle patches in fromImage: {0}
97+
IMG-0096=Unable to patch image {0}. The installed products could not be identified for patching. The most likely cause is that the registry.xml in this image may be invalid.

imagetool/src/test/java/com/oracle/weblogic/imagetool/installer/InstallerTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import org.junit.jupiter.api.Test;
1212

1313
import static org.junit.jupiter.api.Assertions.assertEquals;
14+
import static org.junit.jupiter.api.Assertions.assertNull;
1415

1516
@Tag("unit")
1617
public class InstallerTest {
@@ -58,6 +59,8 @@ void fromProductList() {
5859
assertEquals(FmwInstallerType.WLS, FmwInstallerType.fromProductList("WLS,COH,TOPLINK"));
5960
assertEquals(FmwInstallerType.FMW, FmwInstallerType.fromProductList("INFRA,WLS,COH,TOPLINK"));
6061
assertEquals(FmwInstallerType.SOA_OSB, FmwInstallerType.fromProductList("INFRA,WLS,COH,TOPLINK,BPM,SOA,OSB"));
62+
assertNull(FmwInstallerType.fromProductList(""));
63+
assertNull(FmwInstallerType.fromProductList(null));
6164
}
6265
}
6366

0 commit comments

Comments
 (0)