Skip to content

Commit 3c1f2bc

Browse files
authored
during updateImage, detect fromImage user and group setting (#209)
1 parent 4378bd2 commit 3c1f2bc

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ public CommandResponse call() throws Exception {
7979

8080
String opatchVersion = baseImageProperties.getProperty("OPATCH_VERSION");
8181

82+
String baseImageUsr = baseImageProperties.getProperty("ORACLE_HOME_USER");
83+
String baseImageGrp = baseImageProperties.getProperty("ORACLE_HOME_GROUP");
84+
if (!dockerfileOptions.userid().equals(baseImageUsr) || !dockerfileOptions.groupid().equals(baseImageGrp)) {
85+
return new CommandResponse(-1, "IMG-0087", fromImage, baseImageUsr, baseImageGrp);
86+
}
87+
8288
String lsinventoryText = null;
8389

8490
if (applyingPatches()) {

imagetool/src/main/resources/ImageTool.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,5 @@ IMG-0082=Failed to determine release number for product {0}, version {1}
8484
IMG-0083=Version {0} for patch ID {1} was not found in the available versions: {2}
8585
IMG-0084=No recommended patches found for {0}
8686
IMG-0085=The recommended ADR patch was skipped for the WLS installer, use --patch {0} to apply this patch
87-
IMG-0086=Failed to find patch number [[brightred: {0}]] on Oracle servers, verify the patch number is correct using My Oracle Support.
87+
IMG-0086=Failed to find patch number [[brightred: {0}]] on Oracle servers, verify the patch number is correct using My Oracle Support.
88+
IMG-0087=The Oracle Home directory in --fromImage={0} has an owner and group of {1}:{2}. You must update the image with the same user and group setting from when it was created. Example: --chown={1}:{2}

imagetool/src/main/resources/probe-env/test-update-env.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ if [[ -n "$ORACLE_HOME" ]]; then
4343
echo OPATCH_VERSION="$("$ORACLE_HOME"/OPatch/opatch version 2> /dev/null | grep -oE -m 1 '([[:digit:]\.]+)')"
4444
"$ORACLE_HOME"/OPatch/opatch lsinventory > /tmp/lsout 2> /dev/null
4545

46+
echo ORACLE_HOME_USER="$(stat -c '%U' "$ORACLE_HOME")"
47+
echo ORACLE_HOME_GROUP="$(stat -c '%G' "$ORACLE_HOME")"
48+
4649
if [[ -f "/tmp/lsout" ]]; then
4750
echo LSINV_TEXT="$(base64 -w 0 /tmp/lsout)"
4851
fi

0 commit comments

Comments
 (0)