Skip to content

Commit c89c5a8

Browse files
author
Tom Barnes
committed
Issue 721: DOMAIN_HOME handling when domain resource 'domainHome' not set and 'domainHomeInImage' is 'true'.
1 parent 007fc6b commit c89c5a8

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

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

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,29 @@ function checkEnv() {
107107

108108
#
109109
# exportEffectiveDomainHome
110-
# 1) Look for a config.xml in DOMAIN_HOME/config and DOMAIN_HOME/*/config
111-
# 2) Export DOMAIN_HOME to reflect the actual location
112-
# 3) Trace an Error and return non-zero if not found or more than 1 found
110+
# if DOMAIN_HOME='/u01/oracle/user_projects/domains':
111+
# 1) look for a config.xml in DOMAIN_HOME/config and
112+
# and in DOMAIN_HOME/*/config
113+
# 2) Export DOMAIN_HOME to reflect the actual location
114+
# 3) Trace an Error and return non-zero if not found or more than 1 found
113115
#
114116
function exportEffectiveDomainHome() {
115117
local count=0
116118
local cur_domain_home=""
117119
local eff_domain_home=""
118120
local found_configs=""
119121

120-
for cur_domain_home in "${DOMAIN_HOME?}" "${DOMAIN_HOME}"/*; do
122+
if [ ! "${DOMAIN_HOME?}" = "/u01/oracle/user_projects/domains" ]; then
123+
# nothing to do
124+
return 0
125+
fi
126+
127+
local tfile=$(mktemp /tmp/homes.`basename $0`.XXXXXXXXX)
128+
rm -f $tfile
129+
ls -d ${DOMAIN_HOME} ${DOMAIN_HOME}/* > $tfile
130+
exec 22<> $tfile
131+
132+
while read -u 22 cur_domain_home; do
121133

122134
config_path="${cur_domain_home}/config/config.xml"
123135

@@ -127,20 +139,17 @@ function exportEffectiveDomainHome() {
127139

128140
count=$((count + 1))
129141

130-
if [ $count -gt 1 ]; then
142+
if [ $count -eq 1 ]; then
143+
eff_domain_home="${cur_domain_home}"
144+
found_configs="'${config_path}'"
145+
else
131146
found_configs="${found_configs}, '${config_path}'"
132-
continue
133147
fi
134148

135-
eff_domain_home="${cur_domain_home}"
136-
found_configs="'${config_path}'"
137-
if [ "${cur_domain_home}" = "${DOMAIN_HOME}" ]; then
138-
# when a config.xml is found right away at ${DOMAIN_HOME}/config
139-
# then don't bother looking a level deeper in "${DOMAIN_HOME}"/*/config
140-
break
141-
fi
142149
done
143150

151+
rm -f $tfile
152+
144153
if [ $count -eq 1 ]; then
145154
export DOMAIN_HOME="${eff_domain_home}"
146155
return 0
@@ -150,7 +159,8 @@ function exportEffectiveDomainHome() {
150159
trace "Error: No config.xml found at DOMAIN_HOME/config/config.xml or DOMAIN_HOME/*/config/config.xml, DOMAIN_HOME='$DOMAIN_HOME'. Check your 'domainHome' setting in your WebLogic Operator Domain resource, and your pv/pvc mount location (if any)."
151160
return 1
152161
fi
153-
162+
163+
# if we get this far, count is > 1
154164
trace "Error: More than one config.xml found at DOMAIN_HOME/config/config.xml and DOMAIN_HOME/*/config/config.xml, DOMAIN_HOME='$DOMAIN_HOME': ${found_configs}. Configure your 'domainHome' setting in your WebLogic Operator Domain resource to reference a single WebLogic domain."
155165
return 1
156166
}

0 commit comments

Comments
 (0)