Skip to content

Commit c3e5706

Browse files
committed
Add validation for Apache loadBalancerVolumePath
Signed-off-by: doxiao <[email protected]>
1 parent a1608a6 commit c3e5706

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

kubernetes/create-weblogic-domain-inputs.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,13 @@ loadBalancer: TRAEFIK
102102
# This defines the /location in the built-in Apache plugin configuration module for WebLogic
103103
loadBalancerAppPrepath: /
104104

105-
# Docker volume path for APACHE. By default, it is empty, which causes the volume mount be
106-
# disabled and, thereforem the built-in Apache plugin config be used.
107-
# Use this to provide your own Apache plugin configuration as needed; simply define this
108-
# path and put your own custom_mod_wl_apache.conf file under this path.
105+
# Docker volume path for APACHE.
106+
# By default, the path is empty, and therefore, the built-in default Apache plugin
107+
# configuration is used.
108+
# Use this to provide your own Apache plugin configuration as needed; simply define
109+
# this path and put your own custom_mod_wl_apache.conf file under this path.
110+
# If specified path does not exist, or customer_mod_wl_apache.conf file is missing
111+
# under the specified path, the create domain script will fail with a validation error.
109112
loadBalancerVolumePath:
110113

111114
# Boolean to indicate if the admin port is going to be exposed for APACHE. By default, it is false.

kubernetes/internal/create-weblogic-domain.sh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -604,11 +604,20 @@ function createYamlFiles {
604604
enableLoadBalancerExposeAdminPortPrefix="${disabledPrefix}"
605605
fi
606606

607+
enableLoadBalancerVolumePathPrefix="${disabledPrefix}"
608+
apacheConfigFileName="custom_mod_wl_apache.conf"
607609
if [ ! -z "${loadBalancerVolumePath}" ]; then
608-
enableLoadBalancerVolumePathPrefix="${enabledPrefix}"
609-
sed -i -e "s:%LOAD_BALANCER_VOLUME_PATH%:${loadBalancerVolumePath}:g" ${apacheOutput}
610-
else
611-
enableLoadBalancerVolumePathPrefix="${disabledPrefix}"
610+
if [ ! -d ${loadBalancerVolumePath} ]; then
611+
echo -e "\nERROR: \nThe specified loadBalancerVolumePath $loadBalancerVolumePath does not exist! \n"
612+
fail "Exiting due to a validation error"
613+
elif [ ! -f ${loadBalancerVolumePath}/${apacheConfigFileName} ]; then
614+
echo -e "\nERROR: \nThe required file ${apacheConfigFileName} does not exist under the specified loadBalancerVolumePath $loadBalancerVolumePath! \n"
615+
fail "Exiting due to a validation error"
616+
else
617+
enableLoadBalancerVolumePathPrefix="${enabledPrefix}"
618+
sed -i -e "s:%LOAD_BALANCER_VOLUME_PATH%:${loadBalancerVolumePath}:g" ${apacheOutput}
619+
620+
fi
612621
fi
613622

614623
sed -i -e "s:%ENABLE_LOAD_BALANCER_EXPOSE_ADMIN_PORT%:${enableLoadBalancerExposeAdminPortPrefix}:g" ${apacheOutput}

0 commit comments

Comments
 (0)