|
11 | 11 | import com.oracle.weblogic.imagetool.util.Constants;
|
12 | 12 | import com.oracle.weblogic.imagetool.util.Utils;
|
13 | 13 | import com.oracle.weblogic.imagetool.util.ValidationResult;
|
14 |
| -import picocli.CommandLine.Command; |
15 |
| -import picocli.CommandLine.Option; |
16 | 14 |
|
17 | 15 | import java.io.File;
|
| 16 | +import java.io.IOException; |
18 | 17 | import java.nio.file.Files;
|
19 | 18 | import java.nio.file.Path;
|
20 | 19 | import java.nio.file.Paths;
|
|
26 | 25 | import java.util.List;
|
27 | 26 | import java.util.Properties;
|
28 | 27 | import java.util.Set;
|
29 |
| -import java.util.logging.FileHandler; |
30 | 28 | import java.util.logging.Logger;
|
31 | 29 |
|
| 30 | +import picocli.CommandLine.Command; |
| 31 | +import picocli.CommandLine.Option; |
| 32 | + |
32 | 33 | @Command(
|
33 | 34 | name = "update",
|
34 | 35 | description = "Update WebLogic docker image with selected patches",
|
@@ -90,17 +91,27 @@ public CommandResponse call() throws Exception {
|
90 | 91 | String opatchVersion = baseImageProperties.getProperty("OPATCH_VERSION");
|
91 | 92 |
|
92 | 93 | // We need to find out the actual version number of the opatchBugNumber - what if useCache=always ?
|
| 94 | + String opatchBugNumberVersion = ""; |
93 | 95 |
|
94 | 96 | if (useCache == CachePolicy.ALWAYS) {
|
95 |
| - opatch_1394_required = (latestPSU || !patches.isEmpty()) && |
96 |
| - (Utils.compareVersions(installerVersion, Constants.DEFAULT_WLS_VERSION) >= 0); |
| 97 | + String opatchFile = cacheStore.getValueFromCache(opatchBugNumber + "_opatch"); |
| 98 | + if (opatchFile != null ) { |
| 99 | + opatchBugNumberVersion = Utils.getOpatchVersionFromZip(opatchFile); |
| 100 | + logger.info(String.format("OPatch patch number %s cached file %s version %s", opatchBugNumber, |
| 101 | + opatchFile, opatchBugNumberVersion )); |
| 102 | + } else { |
| 103 | + String msg = String.format("OPatch patch number --opatchBugNumber %s cannot be found in cache", |
| 104 | + opatchBugNumber); |
| 105 | + logger.severe(msg); |
| 106 | + throw new IOException(msg); |
| 107 | + } |
97 | 108 | } else {
|
98 |
| - String opatchBugNumberVersion = ARUUtil.getOPatchVersionByBugNumber(opatchBugNumber, userId, password); |
99 |
| - opatch_1394_required = (latestPSU || !patches.isEmpty()) && |
100 |
| - (Utils.compareVersions(installerVersion, Constants.DEFAULT_WLS_VERSION) >= 0 && |
101 |
| - Utils.compareVersions(opatchVersion, opatchBugNumberVersion) < 0); |
| 109 | + opatchBugNumberVersion = ARUUtil.getOPatchVersionByBugNumber(opatchBugNumber, userId, password); |
102 | 110 | }
|
103 | 111 |
|
| 112 | + opatch_1394_required = (latestPSU || !patches.isEmpty()) && |
| 113 | + (Utils.compareVersions(installerVersion, Constants.DEFAULT_WLS_VERSION) >= 0 && |
| 114 | + Utils.compareVersions(opatchVersion, opatchBugNumberVersion) < 0); |
104 | 115 |
|
105 | 116 | //Do not update or install packages in offline only mode
|
106 | 117 | if (useCache != CachePolicy.ALWAYS) {
|
|
0 commit comments