|
7 | 7 |
|
8 | 8 | source ${SCRIPTPATH}/utils.sh
|
9 | 9 |
|
10 |
| - |
| 10 | +WDT_MINIMUM_VERSION="1.7.3" |
11 | 11 | INTROSPECTCM_IMAGE_MD5="/weblogic-operator/introspectormii/inventory_image.md5"
|
12 | 12 | INTROSPECTCM_CM_MD5="/weblogic-operator/introspectormii/inventory_cm.md5"
|
13 | 13 | INTROSPECTCM_PASSPHRASE_MD5="/weblogic-operator/introspectormii/inventory_passphrase.md5"
|
@@ -283,6 +283,11 @@ function createWLDomain() {
|
283 | 283 | checkDirNotExistsOrEmpty ${IMG_MODELS_HOME}
|
284 | 284 | checkDirNotExistsOrEmpty ${WDT_BINDIR}
|
285 | 285 |
|
| 286 | + checkModelDirectoryExtensions |
| 287 | + if [ "true" != "${WDT_BYPASS_WDT_VERSION_CHECK}" ] ; then |
| 288 | + checkWDTVersion |
| 289 | + fi |
| 290 | + |
286 | 291 | # copy the filter related files to the wdt lib
|
287 | 292 |
|
288 | 293 | cp ${WDT_FILTER_JSON} ${WDT_ROOT}/lib
|
@@ -384,6 +389,63 @@ function checkDirNotExistsOrEmpty() {
|
384 | 389 | trace "Exiting checkDirNotExistsOrEmpty"
|
385 | 390 | }
|
386 | 391 |
|
| 392 | +# limit the file extensions in the model directories |
| 393 | + |
| 394 | +function checkModelDirectoryExtensions() { |
| 395 | + trace "Entering checkModelDirectoryExtensions" |
| 396 | + |
| 397 | + cd ${IMG_MODELS_HOME} |
| 398 | + counter=$(ls -I "*.yaml" -I "*.zip" -I "*.properties" | wc -l) |
| 399 | + if [ $counter -ne 0 ] ; then |
| 400 | + trace SEVERE "Model image directory ${IMG_MODELS_HOME} contains files with unsupported extensions. " \ |
| 401 | + "Expected extensions: .yaml, .properties, or .zip" |
| 402 | + trace SEVERE "Model image directory files with unsupported extensions: " \ |
| 403 | + "'$(ls -I "*.yaml" -I "*.zip" -I "*.properties")'" |
| 404 | + exitOrLoop |
| 405 | + fi |
| 406 | + if [ -d ${WDT_CONFIGMAP_ROOT} ] ; then |
| 407 | + cd ${WDT_CONFIGMAP_ROOT} |
| 408 | + counter=$(ls -I "*.yaml" -I "*.properties" | wc -l) |
| 409 | + if [ $counter -ne 0 ] ; then |
| 410 | + trace SEVERE "Model configmap directory ${WDT_CONFIGMAP_ROOT} contains files with unsupported extensions. " \ |
| 411 | + "Expected extensions: .yaml or .properties" |
| 412 | + trace SEVERE "Model configmap directory files with unsupported extensions: " \ |
| 413 | + "'$(ls -I "*.yaml" -I "*.properties")'" |
| 414 | + exitOrLoop |
| 415 | + fi |
| 416 | + fi |
| 417 | + |
| 418 | + trace "Exiting checkModelDirectoryExtensions" |
| 419 | +} |
| 420 | + |
| 421 | +# Check for WDT version |
| 422 | + |
| 423 | +function checkWDTVersion() { |
| 424 | + trace "Entering checkWDTVersion" |
| 425 | + unzip -c ${WDT_ROOT}/lib/weblogic-deploy-core.jar META-INF/MANIFEST.MF > /tmp/wdtversion.txt || exitOrLoop |
| 426 | + local wdt_version="$(grep "Implementation-Version" /tmp/wdtversion.txt | cut -f2 -d' ' | tr -d '\r' )" || exitOrLoop |
| 427 | + if [ ! -z ${wdt_version} ]; then |
| 428 | + versionGE ${wdt_version} ${WDT_MINIMUM_VERSION} |
| 429 | + if [ $? != "0" ] ; then |
| 430 | + trace SEVERE "Domain Source Type is 'FromModel' and it requires WebLogic Deploy Tool with a minimum " \ |
| 431 | + "version of ${WDT_MINIMUM_VERSION} installed in the image. The version of the WebLogic Deploy Tool installed " \ |
| 432 | + "in the image is ${wdt_version}, you can create another image with an updated version of the WebLogic Deploy " \ |
| 433 | + "Tool and redeploy the domain again. To bypass this check, set environment variable " \ |
| 434 | + "'WDT_BYPASS_WDT_VERSION_CHECK' to 'true'" |
| 435 | + exitOrLoop |
| 436 | + fi |
| 437 | + else |
| 438 | + trace SEVERE "Domain Source Type is 'FromModel' and it requires WebLogic Deploy Tool with a minimum " \ |
| 439 | + "version of ${WDT_MINIMUM_VERSION} installed in the image. The version of the WebLogic Deploy Tool installed " \ |
| 440 | + "in the image cannot be determined, you can create another image with an updated version of the WebLogic Deploy" \ |
| 441 | + " Tool and redeploy the domain again. To bypass this check, set environment variable " \ |
| 442 | + "'WDT_BYPASS_WDT_VERSION_CHECK' to 'true'" |
| 443 | + exitOrLoop |
| 444 | + fi |
| 445 | + |
| 446 | + trace "Exiting checkWDTVersion" |
| 447 | +} |
| 448 | + |
387 | 449 | # getSecretsMD5
|
388 | 450 | #
|
389 | 451 | # concatenate all the secrets, calculate the md5 and delete the file.
|
|
0 commit comments