Skip to content

Commit c82b97c

Browse files
doxiaorjeberhard
authored andcommitted
Honor tokens in javaOptions input property
Signed-off-by: doxiao <[email protected]>
1 parent 25f9d66 commit c82b97c

File tree

3 files changed

+20
-13
lines changed

3 files changed

+20
-13
lines changed

kubernetes/internal/create-weblogic-domain.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,6 @@ function initialize {
400400
weblogicDomainStorageSize \
401401
weblogicCredentialsSecretName \
402402
namespace \
403-
javaOptions \
404403
t3PublicAddress \
405404
version
406405

kubernetes/internal/utility.sh

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function validateInputParamsSpecified {
4343
for p in $*; do
4444
local name=$p
4545
local val=${!name}
46-
if [ -z $val ]; then
46+
if [ -z "$val" ]; then
4747
validationError "The ${name} parameter in ${valuesInputFile} is missing, null or empty"
4848
fi
4949
done
@@ -105,7 +105,13 @@ function parseYaml {
105105
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
106106
awk -F$fs '{
107107
if (length($3) > 0) {
108-
printf("export %s=\"%s\"\n", $2, $3);
108+
# javaOptions may contain tokens that are not allowed in export command
109+
# we need to handle it differently.
110+
if ($2=="javaOptions") {
111+
printf("%s=%s\n", $2, $3);
112+
} else {
113+
printf("export %s=\"%s\"\n", $2, $3);
114+
}
109115
}
110116
}' > $2
111117
}
@@ -115,6 +121,7 @@ function parseYaml {
115121
#
116122
function parseCommonInputs {
117123
exportValuesFile="/tmp/export-values.sh"
124+
tmpFile="/tmp/javaoptions_tmp.dat"
118125
parseYaml ${valuesInputFile} ${exportValuesFile}
119126

120127
if [ ! -f ${exportValuesFile} ]; then
@@ -126,8 +133,17 @@ function parseCommonInputs {
126133
echo Input parameters being used
127134
cat ${exportValuesFile}
128135
echo
129-
source ${exportValuesFile}
130-
rm ${exportValuesFile}
136+
137+
# javaOptions may contain tokens that are not allowed in export command
138+
# we need to handle it differently.
139+
# we set the javaOptions variable that can be used later
140+
tmpStr=`grep "javaOptions" ${exportValuesFile}`
141+
javaOptions=${tmpStr//"javaOptions="/}
142+
143+
# We exclude javaOptions from the exportValuesFile
144+
grep -v "javaOptions" ${exportValuesFile} > ${tmpFile}
145+
source ${tmpFile}
146+
rm ${exportValuesFile} ${tmpFile}
131147
}
132148

133149
#

kubernetes/src/test/java/oracle/kubernetes/operator/create/CreateDomainInputsValidationTest.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -592,14 +592,6 @@ public void createDomain_with_invalidLoadBalancerVolumePath_missingFile_failsAnd
592592
missingFileError(PARAM_LOAD_BALANCER_VOLUME_PATH, val, "custom-mod-wl-apache.conf")));
593593
}
594594

595-
// TBD - shouldn't we allow empty java options?
596-
@Test
597-
public void createDomain_with_missingJavaOptions_failsAndReturnsError() throws Exception {
598-
assertThat(
599-
execCreateDomain(newInputs().javaOptions("")),
600-
failsAndPrints(paramMissingError(PARAM_JAVA_OPTIONS)));
601-
}
602-
603595
@Test
604596
public void createDomain_with_missingVersion_failsAndReturnsError() throws Exception {
605597
assertThat(

0 commit comments

Comments
 (0)