Skip to content

Commit 79d1bd4

Browse files
committed
Temporarily disable trap in diff_model as logFileRotate or testLogFileRotate may return non-zero code
1 parent 8404dc8 commit 79d1bd4

File tree

2 files changed

+38
-15
lines changed

2 files changed

+38
-15
lines changed

operator/src/main/resources/scripts/modelInImage.sh

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ SCRIPT_ERROR=255
6262
WDT_ONLINE_MIN_VERSION="1.9.9"
6363
WDT_OFFLINE_MIN_VERSION="1.7.3"
6464

65+
FATAL_JRF_INTROSPECTOR_ERROR_MSG="Model In Image JRF domain creation and schema initialization encountered an unrecoverable error.
66+
If it is a database credential related error such as wrong password, schema prefix, or database connect
67+
string, then correct the error and patch the domain resource 'domain.spec.introspectVersion' with a new
68+
value. If the error is not related to a database credential, then you must also drop and recreate the
69+
JRF schemas before patching the domain resource. Introspection Error: "
70+
6571
export WDT_MODEL_SECRETS_DIRS="/weblogic-operator/config-overrides-secrets"
6672
[ ! -d ${WDT_MODEL_SECRETS_DIRS} ] && unset WDT_MODEL_SECRETS_DIRS
6773

@@ -75,7 +81,6 @@ if [ ! -d "${WDT_OUTPUT_DIR}" ]; then
7581
createFolder "${WDT_OUTPUT_DIR}"
7682
fi
7783

78-
7984
# sort_files sort the files according to the names and naming conventions and write the result to stdout
8085
# $1 directory
8186
# $2 extension
@@ -621,6 +626,9 @@ function diff_model_v1() {
621626

622627
function diff_model() {
623628
trace "Entering diff_model"
629+
# wdt shell script or logFileRotate may return non-zero code if trap is on, then it will go to trap instead
630+
# temporarily disable it
631+
stop_trap
624632

625633
export __WLSDEPLOY_STORE_MODEL__=1
626634
# $1 - new model, $2 original model
@@ -673,6 +681,9 @@ function diff_model() {
673681

674682
wdtRotateAndCopyLogFile "${WDT_COMPARE_MODEL_LOG}"
675683

684+
# restore trap
685+
start_trap
686+
676687
trace "Exiting diff_model"
677688
}
678689

@@ -902,9 +913,7 @@ function wdtCreatePrimordialDomain() {
902913
# output configmap and save it for reuse.
903914

904915
${WDT_BINDIR}/createDomain.sh ${wdtArgs} > ${WDT_OUTPUT} 2>&1
905-
906916
else
907-
908917
# We get here only for JRF domain 'second time' (or more) case.
909918

910919
# JRF wallet reuse note:
@@ -928,7 +937,8 @@ function wdtCreatePrimordialDomain() {
928937
# without admin intervention (retrying can compound the problem and obscure the original issue).
929938
#
930939
if [ "JRF" == "$WDT_DOMAIN_TYPE" ] && [ -z "${OPSS_FLAGS}" ] ; then
931-
trace SEVERE "Model in Image: FatalIntrospectorError: WDT Create Primordial Domain Failed, ret=${ret}"
940+
trace SEVERE "Model in Image: FatalIntrospectorError: WDT Create Domain Failed, return ${ret}. " \
941+
${FATAL_JRF_INTROSPECTOR_ERROR_MSG}
932942
else
933943
trace SEVERE "Model in Image: WDT Create Primordial Domain Failed, ret=${ret}"
934944
fi
@@ -937,6 +947,9 @@ function wdtCreatePrimordialDomain() {
937947
else
938948
trace "WDT Create Domain Succeeded, ret=${ret}:"
939949
cat ${WDT_OUTPUT}
950+
if [ "JRF" == "$WDT_DOMAIN_TYPE" ]; then
951+
CREATED_JRF_PRIMODIAL="true"
952+
fi
940953
fi
941954

942955
wdtRotateAndCopyLogFile "${WDT_CREATE_DOMAIN_LOG}"
@@ -974,7 +987,12 @@ function wdtUpdateModelDomain() {
974987
ret=$?
975988

976989
if [ $ret -ne 0 ]; then
977-
trace SEVERE "WDT Update Domain command Failed:"
990+
if [ "true" == "${CREATED_JRF_PRIMODIAL}" ] ; then
991+
trace SEVERE "Model in Image: FatalIntrospectorError: WDT Update Domain Failed, return ${ret}. " \
992+
${FATAL_JRF_INTROSPECTOR_ERROR_MSG}
993+
else
994+
trace SEVERE "WDT Update Domain command Failed:"
995+
fi
978996
cat ${WDT_OUTPUT}
979997
exitOrLoop
980998
fi
@@ -1037,7 +1055,7 @@ function wdtHandleOnlineUpdate() {
10371055
for file in $(sort_files ${IMG_ARCHIVES_ROOTDIR} "*.zip")
10381056
do
10391057
# expand the archive domain libraries to the domain lib
1040-
cd ${DOMAIN_HOME}/lib || return exitOrLoop
1058+
cd ${DOMAIN_HOME}/lib || exitOrLoop
10411059
${JAVA_HOME}/bin/jar xf ${IMG_ARCHIVES_ROOTDIR}/${file} wlsdeploy/domainLibraries/
10421060

10431061
if [ $? -ne 0 ] ; then
@@ -1339,10 +1357,8 @@ function logSevereAndExit() {
13391357
# 1 - Name of the log file to rotate and copy to WDT output directory.
13401358
function wdtRotateAndCopyLogFile() {
13411359
local logFileName=$1
1342-
testLogFileRotate "${WDT_OUTPUT_DIR}/${logFileName}"
1343-
[ $? -ne 0 ] && trace SEVERE "Error accessing '${WDT_OUTPUT_DIR}'. See previous log messages." && exit 1
13441360

1345-
logFileRotate ${WDT_OUTPUT_DIR}/${logFileName} ${WDT_LOG_FILE_MAX:-11}
1361+
logFileRotate "${WDT_OUTPUT_DIR}/${logFileName}" "${WDT_LOG_FILE_MAX:-11}"
13461362

13471363
cp ${WDT_ROOT}/logs/${logFileName} ${WDT_OUTPUT_DIR}/
13481364
}

operator/src/main/resources/scripts/utils.sh

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,10 @@ function logFileRotateInner() {
160160
_logmax_=$((logmax - 1))
161161
fi
162162
for logcur in $(logFilesReverse ${1} | tail -n +${_logmax_}); do
163-
[ ! "$3" = "quiet" ] && trace "Removing old log file '${logcur}'."
164-
rm $logcur
163+
if [ -f "$logcur" ] ; then
164+
[ ! "$3" = "quiet" ] && trace "Removing old log file '${logcur}'."
165+
rm $logcur
166+
fi
165167
done
166168

167169
# if highest lognum is 99999, renumber existing files starting with 1
@@ -172,7 +174,9 @@ function logFileRotateInner() {
172174
local logcur
173175
for logcur in $(logFiles "$1"); do
174176
lastlognum=$((lastlognum + 1))
175-
mv "$logcur" "${1}$(printf "%0.5i" $lastlognum)"
177+
if [ -f "$logcur" ] ; then
178+
mv "$logcur" "${1}$(printf "%0.5i" $lastlognum)"
179+
fi
176180
done
177181
fi
178182

@@ -182,13 +186,16 @@ function logFileRotateInner() {
182186
if [ -f "$1" ]; then
183187
local nextlognum=$((lastlognum + 1))
184188
[ ! "$3" = "quiet" ] && trace "Rotating '$1' to '${1}$(printf "%0.5i" $nextlognum)'."
185-
mv "$1" "${1}$(printf "%0.5i" $nextlognum)"
189+
if [ -f "$1" ] ; then
190+
mv "$1" "${1}$(printf "%0.5i" $nextlognum)"
191+
fi
186192
fi
187193
else
188-
rm -f "$1"
194+
if [ -f "$1" ] ; then
195+
rm -f "$1"
196+
fi
189197
fi
190198
}
191-
192199
#
193200
# internal helper for logFileRotate():
194201
#

0 commit comments

Comments
 (0)