Skip to content

Commit 6425a82

Browse files
committed
Merge branch 'fix-eval-script-error-42' into 'release/4.2'
Change to call real wlst.sh for model-diff.py, calling jython directly has... See merge request weblogic-cloud/weblogic-kubernetes-operator!4753
2 parents 5b41a87 + a67a6a5 commit 6425a82

File tree

2 files changed

+23
-20
lines changed

2 files changed

+23
-20
lines changed

operator/src/main/resources/scripts/model-diff.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,17 +154,16 @@ def main():
154154
rcfh = open('/tmp/model_diff_rc', 'w')
155155
rcfh.write(",".join(map(str,changed_items)))
156156
rcfh.close()
157-
System.exit(0)
157+
exit()
158158
except:
159159
exc_type, exc_obj, exc_tb = sys.exc_info()
160160
eeString = traceback.format_exception(exc_type, exc_obj, exc_tb)
161161
print eeString
162-
System.exit(-1)
163-
if __name__ == "__main__":
164-
all_changes = []
165-
all_added = []
166-
all_removed = []
167-
changed_items = []
168-
main()
162+
sys.exit(2)
163+
all_changes = []
164+
all_added = []
165+
all_removed = []
166+
changed_items = []
167+
main()
169168

170169

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

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -631,27 +631,31 @@ diff_model() {
631631
local JAVA_PROPS="-Dpython.console= ${JAVA_PROPS} -Djava.security.egd=file:/dev/./urandom"
632632
local CP=${ORACLE_SERVER_DIR}/server/lib/weblogic.jar
633633
# Get partial models for sanity check for forbidden attribute change
634-
local SERVER_OR_SERVERTEMPLATES_NAMES=$(jq '{ topology: { Server: (.topology.Server | with_entries(.value = {})),
634+
local SERVER_OR_SERVERTEMPLATES_NAMES
635+
SERVER_OR_SERVERTEMPLATES_NAMES=$(jq '{ topology: { Server: (.topology.Server | with_entries(.value = {})),
635636
ServerTemplate: (if .topology.ServerTemplate then (.topology.ServerTemplate | with_entries(.value = {})) else empty end)
636637
}} | if .topology.ServerTemplate == {} then del(.topology.ServerTemplate) else . end' $2)
637638
rc=$?
638639
if [ $rc -ne 0 ] ; then
639640
trace SEVERE "Failed to extract server names from original model using jq "$rc
640641
exitOrLoop
641642
fi
642-
local PARTIAL_DIFFED_MODEL=$(jq '{domainInfo: .domainInfo, topology: .topology} | with_entries(select(.value != null))' /tmp/diffed_model.json)
643-
rc=$?
644-
if [ $rc -ne 0 ] ; then
645-
trace SEVERE "Failed to extract domainInfo and topology from delta model using jq "$rc
646-
exitOrLoop
643+
local PARTIAL_DIFFED_MODEL
644+
if [ -f /tmp/diffed_model.json ] ; then
645+
PARTIAL_DIFFED_MODEL=$(jq '{domainInfo: .domainInfo, topology: .topology} | with_entries(select(.value != null))' /tmp/diffed_model.json)
646+
rc=$?
647+
if [ $rc -ne 0 ] ; then
648+
trace SEVERE "Failed to extract domainInfo and topology from delta model using jq "$rc
649+
exitOrLoop
650+
fi
651+
else
652+
PARTIAL_DIFFED_MODEL="{}"
647653
fi
648-
649-
${JAVA_HOME}/bin/java -cp ${CP} \
650-
${JAVA_PROPS} \
651-
org.python.util.jython \
652-
${SCRIPTPATH}/model-diff.py "$SERVER_OR_SERVERTEMPLATES_NAMES" "$PARTIAL_DIFFED_MODEL" > ${WDT_OUTPUT} 2>&1
654+
# Use the real wlst.sh and not the operator wrap script, calling jypthon directory has problem understanding WLST boolean false, true etc..
655+
# eval will fail
656+
${ORACLE_HOME}/oracle_common/common/bin/wlst.sh ${SCRIPTPATH}/model-diff.py "${SERVER_OR_SERVERTEMPLATES_NAMES}" "${PARTIAL_DIFFED_MODEL}" > ${WDT_OUTPUT} 2>&1
653657
if [ $? -ne 0 ] ; then
654-
trace SEVERE "Failed to compare models. Error output:"
658+
trace SEVERE "Failed to interpret models results . Error output:"
655659
cat ${WDT_OUTPUT}
656660
exitOrLoop
657661
fi

0 commit comments

Comments
 (0)