Skip to content

Commit bf142e0

Browse files
jshum2479ddsharpe
authored andcommitted
check for opatch only when we need to apply patch (#85)
* check for opatch only when we need to apply patch * refactor
1 parent 8ad16e7 commit bf142e0

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

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

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -82,29 +82,31 @@ public CommandResponse call() throws Exception {
8282
String opatchVersion = baseImageProperties.getProperty("OPATCH_VERSION");
8383

8484
// We need to find out the actual version number of the opatchBugNumber - what if useCache=always ?
85-
String opatchBugNumberVersion;
85+
String lsinventoryText = null;
86+
87+
if (applyingPatches()) {
88+
89+
String opatchBugNumberVersion;
8690

87-
if (userId == null && password == null) {
88-
String opatchFile = cacheStore.getValueFromCache(opatchBugNumber + "_opatch");
89-
if (opatchFile != null) {
90-
opatchBugNumberVersion = Utils.getOpatchVersionFromZip(opatchFile);
91-
logger.info("IMG-0008", opatchBugNumber, opatchFile, opatchBugNumberVersion);
91+
if (userId == null && password == null) {
92+
String opatchFile = cacheStore.getValueFromCache(opatchBugNumber + "_opatch");
93+
if (opatchFile != null) {
94+
opatchBugNumberVersion = Utils.getOpatchVersionFromZip(opatchFile);
95+
logger.info("IMG-0008", opatchBugNumber, opatchFile, opatchBugNumberVersion);
96+
} else {
97+
String msg = String.format("OPatch patch number --opatchBugNumber %s cannot be found in cache. "
98+
+ "Please download it manually and add it to the cache.", opatchBugNumber);
99+
logger.severe(msg);
100+
throw new IOException(msg);
101+
}
92102
} else {
93-
String msg = String.format("OPatch patch number --opatchBugNumber %s cannot be found in cache",
94-
opatchBugNumber);
95-
logger.severe(msg);
96-
throw new IOException(msg);
103+
opatchBugNumberVersion = ARUUtil.getOPatchVersionByBugNumber(opatchBugNumber, userId, password);
97104
}
98-
} else {
99-
opatchBugNumberVersion = ARUUtil.getOPatchVersionByBugNumber(opatchBugNumber, userId, password);
100-
}
101105

102-
if (applyingPatches() && Utils.compareVersions(opatchVersion, opatchBugNumberVersion) < 0) {
103-
addOPatch1394ToImage(tmpDir, opatchBugNumber);
104-
}
106+
if (Utils.compareVersions(opatchVersion, opatchBugNumberVersion) < 0) {
107+
addOPatch1394ToImage(tmpDir, opatchBugNumber);
108+
}
105109

106-
String lsinventoryText = null;
107-
if (latestPSU || !patches.isEmpty()) {
108110
logger.finer("Verifying Patches to WLS ");
109111
if (userId == null) {
110112
logger.warning("IMG-0009");

0 commit comments

Comments
 (0)