Skip to content

Commit e3ff472

Browse files
authored
fix new OPatch version installer (#102)
1 parent a64c3ba commit e3ff472

File tree

5 files changed

+34
-7
lines changed

5 files changed

+34
-7
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,10 @@ void addOPatch1394ToImage(String tmpDir, String opatchBugNumber) throws Exceptio
247247
String filePath =
248248
new PatchFile(useCache, Constants.OPATCH_PATCH_TYPE, Constants.OPATCH_PATCH_TYPE, opatchBugNumber,
249249
userId, password).resolve(cacheStore);
250-
Files.copy(Paths.get(filePath), Paths.get(tmpDir, new File(filePath).getName()));
250+
String filename = new File(filePath).getName();
251+
Files.copy(Paths.get(filePath), Paths.get(tmpDir, filename));
251252
dockerfileOptions.setOPatchPatchingEnabled();
253+
dockerfileOptions.setOPatchFileName(filename);
252254
}
253255

254256
private void handleChown() {

imagetool/src/main/java/com/oracle/weblogic/imagetool/impl/PatchFile.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,16 @@ public PatchFile(CachePolicy cachePolicy, String category, String version, Strin
4343
public String resolve(CacheStore cacheStore) throws Exception {
4444
//patchId is null in case of latestPSU
4545

46+
logger.entering();
4647
String filePath = cacheStore.getValueFromCache(getKey());
4748
boolean fileExists = isFileOnDisk(filePath);
4849

50+
if (fileExists) {
51+
logger.info("IMG-0017", category, patchId, filePath);
52+
} else {
53+
logger.fine("Could not find patch in cache category={0} version={1} patchId={2}",
54+
category, version, patchId);
4955

50-
logger.finest("PatchFile.resolve: Patch file in cache?: " + fileExists);
51-
52-
if (!fileExists) {
5356
if (userId == null || password == null)
5457
throw new Exception(String.format(
5558
"Patch %s is not in the cache store and you have not provide Oracle Support "
@@ -60,7 +63,7 @@ public String resolve(CacheStore cacheStore) throws Exception {
6063
filePath = downloadPatch(cacheStore);
6164
}
6265

63-
logger.finest("PatchFile.resolve: resolved filepath " + filePath);
66+
logger.exiting(filePath);
6467
return filePath;
6568
}
6669

imagetool/src/main/java/com/oracle/weblogic/imagetool/util/DockerfileOptions.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public class DockerfileOptions {
3434
private String domainHome;
3535
private String tempDirectory;
3636
private String baseImageName;
37+
private String opatchFileName;
3738

3839
// WDT values
3940
private String wdtHome;
@@ -284,6 +285,26 @@ public DockerfileOptions setOPatchPatchingEnabled() {
284285
return this;
285286
}
286287

288+
/**
289+
* Set filename for OPatch patch.
290+
*
291+
* @return this DockerfileOptions object
292+
*/
293+
public DockerfileOptions setOPatchFileName(String value) {
294+
opatchFileName = value;
295+
return this;
296+
}
297+
298+
/**
299+
* Referenced by Dockerfile template, provides OPatch filename.
300+
*
301+
* @return simple filename for OPatch Patch.
302+
*/
303+
@SuppressWarnings("unused")
304+
public String opatchFileName() {
305+
return opatchFileName;
306+
}
307+
287308
/**
288309
* Referenced by Dockerfile template, for enabling WDT function.
289310
*

imagetool/src/main/resources/ImageTool.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ IMG-0013=Error parsing additional build commands file {0}
1515
IMG-0014=Additional build command section, {0}, was not one of the valid sections: {1}
1616
IMG-0015=Additional build commands, adding {0} lines to section [{1}]
1717
IMG-0016=Image Tool build ID: {0}
18+
IMG-0017=Using {0} patch {1} from cache: {2}

imagetool/src/main/resources/docker-files/Create_Image.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ COPY --chown={{userid}}:{{groupid}} $WLS_PKG wls.rsp {{{tempDir}}}/
8787
COPY --chown={{userid}}:{{groupid}} $ORAINST $INV_LOC/
8888

8989
{{#isOpatchPatchingEnabled}}
90-
COPY --chown={{userid}}:{{groupid}} p28186730_139400_Generic.zip {{{tempDir}}}/opatch/
90+
COPY --chown={{userid}}:{{groupid}} {{{opatchFileName}}} {{{tempDir}}}/opatch/
9191
{{/isOpatchPatchingEnabled}}
9292

9393
{{#isPatchingEnabled}}
@@ -105,7 +105,7 @@ RUN unzip -q {{{tempDir}}}/$WLS_PKG -d {{{tempDir}}} \
105105
-responseFile {{{tempDir}}}/wls.rsp -invPtrLoc $INV_LOC/$ORAINST -ignoreSysPrereqs -force -novalidation \
106106
{{#isOpatchPatchingEnabled}}
107107
&& cd {{{tempDir}}}/opatch \
108-
&& {{{java_home}}}/bin/jar -xf {{{tempDir}}}/opatch/p28186730_139400_Generic.zip \
108+
&& {{{java_home}}}/bin/jar -xf {{{tempDir}}}/opatch/{{{opatchFileName}}} \
109109
&& {{{java_home}}}/bin/java -jar {{{tempDir}}}/opatch/6880880/opatch_generic.jar -silent -ignoreSysPrereqs -force -novalidation oracle_home={{{oracle_home}}} \
110110
{{/isOpatchPatchingEnabled}}
111111
{{#isPatchingEnabled}}

0 commit comments

Comments
 (0)