@@ -16,6 +16,7 @@ INTROSPECTCM_MERGED_MODEL="/weblogic-operator/introspectormii/merged_model.json"
16
16
INTROSPECTCM_WLS_VERSION=" /weblogic-operator/introspectormii/wls.version"
17
17
INTROSPECTCM_JDK_PATH=" /weblogic-operator/introspectormii/jdk.path"
18
18
INTROSPECTCM_SECRETS_AND_ENV_MD5=" /weblogic-operator/introspectormii/secrets_and_env.md5"
19
+ INTROSPECTCM_DOMAIN_WDT_VERSION=" /weblogic-operator/introspectormii/domain_wdt_version"
19
20
PRIMORDIAL_DOMAIN_ZIPPED=" /weblogic-operator/introspectormii/primordial_domainzip.secure"
20
21
WLSDOMAIN_CONFIG_ZIPPED=" /weblogic-operator/introspectormii//domainzip.secure"
21
22
INTROSPECTJOB_IMAGE_MD5=" /tmp/inventory_image.md5"
@@ -442,6 +443,9 @@ checkWDTVersion() {
442
443
exitOrLoop
443
444
fi
444
445
446
+ if versionGE ${WDT_VERSION} " 4.0.0" ; then
447
+ echo " ${WDT_VERSION} " > /tmp/domain_wdt_version
448
+ fi
445
449
trace " Exiting checkWDTVersion"
446
450
}
447
451
@@ -505,7 +509,7 @@ createModelDomain() {
505
509
trace " Using newly created domain"
506
510
elif [ -f ${PRIMORDIAL_DOMAIN_ZIPPED} ] ; then
507
511
trace " Using existing primordial domain"
508
- cd / && base64 -d ${PRIMORDIAL_DOMAIN_ZIPPED} > ${LOCAL_PRIM_DOMAIN_ZIP} && tar -pxzf ${LOCAL_PRIM_DOMAIN_ZIP}
512
+ restoreIntrospectorPrimordialDomain || return 1
509
513
# create empty lib since we don't archive it in primordial zip and WDT will fail without it
510
514
createFolder " ${DOMAIN_HOME} /lib" " This is the './lib' directory within directory 'domain.spec.domainHome'." || exitOrLoop
511
515
# Since the SerializedSystem ini is encrypted, restore it first
@@ -536,6 +540,13 @@ restorePrimordialDomain() {
536
540
restoreEncodedTar " primordial_domainzip.secure" || return 1
537
541
}
538
542
543
+ restoreIntrospectorPrimordialDomain () {
544
+ cd / || return 1
545
+ cat $( ls /weblogic-operator/introspectormii* /primordial_domainzip.secure | sort -t- -k3) > /tmp/domain.secure || return 1
546
+ base64 -d " /tmp/domain.secure" > $LOCAL_PRIM_DOMAIN_ZIP || return 1
547
+ tar -pxzf $LOCAL_PRIM_DOMAIN_ZIP || return 1
548
+ }
549
+
539
550
# Restores the specified directory, targz'ed and stored in one or more config maps after base 64 encoding
540
551
# args:
541
552
# $1 the name of the encoded file in the config map
@@ -643,7 +654,9 @@ createPrimordialDomain() {
643
654
trace " Entering createPrimordialDomain"
644
655
local create_primordial_tgz=0
645
656
local recreate_domain=0
646
- if [ -f ${PRIMORDIAL_DOMAIN_ZIPPED} ] ; then
657
+
658
+
659
+ if [ -f ${PRIMORDIAL_DOMAIN_ZIPPED} ] ; then
647
660
# If there is an existing domain in the cm - this is update in the lifecycle
648
661
# Call WDT validateModel.sh to generate the new merged mdoel
649
662
trace " Checking if security info has been changed"
@@ -672,6 +685,14 @@ createPrimordialDomain() {
672
685
diff_model_v1 ${NEW_MERGED_MODEL} ${DECRYPTED_MERGED_MODEL}
673
686
fi
674
687
688
+ if versionGE ${WDT_VERSION} " 4.0.0" ; then
689
+ # If this is WDT 4.0 or newer and there is an existing primordial domain and no domain version
690
+ # then it is created from WDT 3.x, force recreate of the domain
691
+ if [ -f ${PRIMORDIAL_DOMAIN_ZIPPED} ] && [ ! -f ${INTROSPECTCM_DOMAIN_WDT_VERSION} ] ; then
692
+ recreate_domain=1
693
+ fi
694
+ fi
695
+
675
696
if [ " ${MERGED_MODEL_ENVVARS_SAME} " == " false" ] ; then
676
697
677
698
diff_rc=$( cat /tmp/model_diff_rc)
@@ -1268,8 +1289,8 @@ encrypt_decrypt_domain_secret() {
1268
1289
trace " Exiting encrypt_decrypt_domain_secret"
1269
1290
}
1270
1291
1271
- # prepare mii server
1272
- restorAppAndLibs () {
1292
+ # restore App Libs and others from the archive
1293
+ restoreAppAndLibs () {
1273
1294
1274
1295
createFolder " ${DOMAIN_HOME} /lib" " This is the './lib' directory within DOMAIN_HOME directory 'domain.spec.domainHome'." || return 1
1275
1296
local WLSDEPLOY_DOMAINLIB=" wlsdeploy/domainLibraries"
@@ -1308,6 +1329,16 @@ restorAppAndLibs() {
1308
1329
trace SEVERE " Domain Source Type is FromModel, error in extracting application archive ${IMG_ARCHIVES_ROOTDIR} /${file} "
1309
1330
return 1
1310
1331
fi
1332
+
1333
+ if versionGE ${WDT_VERSION} " 4.0.0" ; then
1334
+ trace INFO " Newer version of WDT 4.0.0 - check if there is old archive format of these files"
1335
+ if [ -d ${DOMAIN_HOME} /wlsdeploy/custom ] ; then
1336
+ # copy to under DOMAIN_HOME/config
1337
+ mkdir -p ${DOMAIN_HOME} /config/wlsdeploy/custom
1338
+ cp -R ${DOMAIN_HOME} /wlsdeploy/custom/* ${DOMAIN_HOME} /config/wlsdeploy/custom
1339
+ fi
1340
+
1341
+ fi
1311
1342
done
1312
1343
1313
1344
}
@@ -1318,6 +1349,10 @@ restoreZippedDbWallets() {
1318
1349
if [ " $count " -gt 0 ] ; then
1319
1350
find ${DOMAIN_HOME} /wlsdeploy/dbWallets/* /* .zip -type f | xargs -I % sh -c ' unzip -jo % -d $(dirname %) ; rm %'
1320
1351
fi
1352
+ count=$( find ${DOMAIN_HOME} /config/wlsdeploy/dbWallets/* /* .zip -type f 2> /dev/null | wc -l)
1353
+ if [ " $count " -gt 0 ] ; then
1354
+ find ${DOMAIN_HOME} /config/wlsdeploy/dbWallets/* /* .zip -type f | xargs -I % sh -c ' unzip -jo % -d $(dirname %) ; rm %'
1355
+ fi
1321
1356
}
1322
1357
1323
1358
@@ -1358,7 +1393,7 @@ prepareMIIServer() {
1358
1393
# during introspection, it will overwrite the tokenized version in the archive.
1359
1394
1360
1395
trace " Model-in-Image: Restoring apps and libraries"
1361
- restorAppAndLibs || return 1
1396
+ restoreAppAndLibs || return 1
1362
1397
1363
1398
trace " Model-in-Image: Restore domain config"
1364
1399
restoreDomainConfig || return 1
@@ -1378,14 +1413,19 @@ logSevereAndExit() {
1378
1413
exitOrLoop
1379
1414
}
1380
1415
1381
- # Function to expand the WDT custom folder from the archive before calling update or create domain.
1416
+ # Function to expand the WDT custom/wallet folders from the archive before calling update domain.
1417
+ # The domain may be created by WDT 3 and older archive format, restore any entries prior to update
1418
+ # new 4.0 entry paths are config/**
1382
1419
expandWdtArchiveCustomDir () {
1383
1420
cd ${DOMAIN_HOME} || exitOrLoop
1384
1421
for file in $( sort_files ${IMG_ARCHIVES_ROOTDIR} " *.zip" )
1385
1422
do
1386
1423
${JAVA_HOME} /bin/jar xf ${IMG_ARCHIVES_ROOTDIR} /${file} wlsdeploy/custom
1424
+ ${JAVA_HOME} /bin/jar xf ${IMG_ARCHIVES_ROOTDIR} /${file} wlsdeploy/dbWallets
1425
+ ${JAVA_HOME} /bin/jar xf ${IMG_ARCHIVES_ROOTDIR} /${file} config/wlsdeploy/custom
1387
1426
done
1388
1427
1389
- CUSTOM_DIR=${DOMAIN_HOME} /wlsdeploy/custom
1390
- traceDirs before CUSTOM_DIR
1428
+ restoreZippedDbWallets
1429
+ trace " Listing domain home directories"
1430
+ ls -lR ${DOMAIN_HOME}
1391
1431
}
0 commit comments