Skip to content

Commit

Permalink
Allow non-patching operations on images with unidentified products (#293
Browse files Browse the repository at this point in the history
)

* Allow non-patching operations on images where the installed products cannot be identified through the registry.xml
  • Loading branch information
ddsharpe authored Jul 9, 2021
1 parent 2a41608 commit a8cd71a
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ List<AruPatch> getLatestPsu(AruProduct product, String version, String userId, S
logger.exiting();
return Collections.emptyList();
} catch (IOException | XPathExpressionException e) {
throw new AruException(Utils.getMessage("IMG-0032", product.description(), version), e);
AruException aruE = new AruException(Utils.getMessage("IMG-0032", product.description(), version), e);
logger.throwing(aruE);
throw aruE;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,17 @@ public CommandResponse call() throws Exception {

FmwInstallerType installerType = FmwInstallerType.fromProductList(
baseImageProperties.getProperty("oracleInstalledProducts"));
logger.info("IMG-0094", installerType);
// resolve required patches
handlePatchFiles(installerType, installedPatches);
if (installerType == null) {
logger.fine("Unable to detect installed products from image {0}", fromImage);
// This error occurred with the 12.2.1.4 quick slim image because registry.xml was missing data
if (applyingPatches()) {
return new CommandResponse(1, "IMG-0096", fromImage);
}
} else {
logger.info("IMG-0094", installerType);
// resolve required patches
handlePatchFiles(installerType, installedPatches);
}

// create dockerfile
String dockerfile = Utils.writeDockerfile(tmpDir + File.separator + "Dockerfile",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ public static boolean isBaseWeblogicServer(FmwInstallerType value) {
*/
public static FmwInstallerType fromProductList(String products) {
logger.entering(products);
if (Utils.isEmptyString(products)) {
return null;
}

// create a set from the comma-separated list
Set<AruProduct> productSet = Stream.of(products.split(","))
.filter(e -> !"TOPLINK".equals(e)) // skip TOPLINK product (WLS always contains TOPLINK)
Expand Down
1 change: 1 addition & 0 deletions imagetool/src/main/resources/ImageTool.properties
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,4 @@ IMG-0092=ORACLE_HOME already exists in {0} (--fromImage), skipping middleware in
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.
IMG-0094=Source image installer type: ([[green: {0}]])
IMG-0095=Unable to parse response for Oracle patches in fromImage: {0}
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.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;

@Tag("unit")
public class InstallerTest {
Expand Down Expand Up @@ -58,6 +59,8 @@ void fromProductList() {
assertEquals(FmwInstallerType.WLS, FmwInstallerType.fromProductList("WLS,COH,TOPLINK"));
assertEquals(FmwInstallerType.FMW, FmwInstallerType.fromProductList("INFRA,WLS,COH,TOPLINK"));
assertEquals(FmwInstallerType.SOA_OSB, FmwInstallerType.fromProductList("INFRA,WLS,COH,TOPLINK,BPM,SOA,OSB"));
assertNull(FmwInstallerType.fromProductList(""));
assertNull(FmwInstallerType.fromProductList(null));
}
}

0 comments on commit a8cd71a

Please sign in to comment.