@@ -48,7 +48,7 @@ MII_UPDATE_NO_CHANGES_TO_APPLY=false
4848UNSAFE_ONLINE_UPDATE=0
4949SAFE_ONLINE_UPDATE=1
5050FATAL_MODEL_CHANGES=2
51- MODELS_SAME=3
51+ MERGED_MODEL_ENVVARS_SAME= " false "
5252SECURITY_INFO_UPDATED=4
5353RCU_PASSWORD_CHANGED=5
5454NOT_FOR_ONLINE_UPDATE=6
@@ -334,7 +334,7 @@ function createWLDomain() {
334334
335335 local version_changed=0
336336 local jdk_changed=0
337- local secrets_and_env_changed =0
337+ SECRETS_AND_ENV_CHANGED =0
338338 trace " current version " ${current_version}
339339
340340 getSecretsAndEnvMD5
@@ -346,19 +346,10 @@ function createWLDomain() {
346346 previous_secrets_and_env_md5=$( cat ${INTROSPECTCM_SECRETS_AND_ENV_MD5} )
347347 if [ " ${current_secrets_and_env_md5} " != " ${previous_secrets_and_env_md5} " ]; then
348348 trace " Secrets and env different: old_md5=${previous_secrets_and_env_md5} new_md5=${current_secrets_and_env_md5} "
349- secrets_and_env_changed =1
349+ SECRETS_AND_ENV_CHANGED =1
350350 fi
351351 fi
352352
353- # If No WDT artifacts changed but WLS version changed
354- # if [ -f ${INTROSPECTCM_WLS_VERSION} ] ; then
355- # previous_version=$(cat ${INTROSPECTCM_WLS_VERSION})
356- # if [ "${current_version}" != "${previous_version}" ]; then
357- # trace "version different: before: ${previous_version} current: ${current_version}"
358- # version_changed=1
359- # fi
360- # fi
361-
362353 if [ -f ${INTROSPECTCM_JDK_PATH} ] ; then
363354 previous_jdkpath=$( cat ${INTROSPECTCM_JDK_PATH} )
364355 if [ " ${current_jdkpath} " != " ${previous_jdkpath} " ]; then
@@ -380,18 +371,20 @@ function createWLDomain() {
380371
381372 compareArtifactsMD5
382373
383- # Set this so that the introspectDomain.sh can decidde to call the python script of not
374+ # Set this so that the introspectDomain.sh can decide to call the python script of not
384375 DOMAIN_CREATED=0
385376
386377 # something changed in the wdt artifacts or wls version changed
387378 # create domain again
388379
389380 if [ ${WDT_ARTIFACTS_CHANGED} -ne 0 ] || [ ${jdk_changed} -eq 1 ] \
390- || [ ${secrets_and_env_changed } -ne 0 ] ; then
381+ || [ ${SECRETS_AND_ENV_CHANGED } -ne 0 ] ; then
391382
392383 trace " Need to create domain ${WDT_DOMAIN_TYPE} "
393384 createModelDomain
394- DOMAIN_CREATED=1
385+ if [ " ${MERGED_MODEL_ENVVARS_SAME} " == " false" ] ; then
386+ DOMAIN_CREATED=1
387+ fi
395388 else
396389 trace " Nothing changed no op"
397390 fi
@@ -528,26 +521,29 @@ function createModelDomain() {
528521 trace " Entering createModelDomain"
529522 createPrimordialDomain
530523
531- # if there is a new primordial domain created then use newly created primordial domain otherwise
532- # if the primordial domain already in the configmap, restore it
533- #
524+ if [ " ${MERGED_MODEL_ENVVARS_SAME} " == " false" ] ; then
525+ # if there is a new primordial domain created then use newly created primordial domain otherwise
526+ # if the primordial domain already in the configmap, restore it
527+ #
534528
535- if [ -f " ${LOCAL_PRIM_DOMAIN_ZIP} " ] ; then
536- trace " Using newly created domain"
537- elif [ -f ${PRIMORDIAL_DOMAIN_ZIPPED} ] ; then
538- trace " Using existing primordial domain"
539- cd / && base64 -d ${PRIMORDIAL_DOMAIN_ZIPPED} > ${LOCAL_PRIM_DOMAIN_ZIP} && tar -xzf ${LOCAL_PRIM_DOMAIN_ZIP}
540- # create empty lib since we don't archive it in primordial zip and WDT will fail without it
541- mkdir ${DOMAIN_HOME} /lib
542- # Since the SerializedSystem ini is encrypted, restore it first
543- local MII_PASSPHRASE=$( cat ${RUNTIME_ENCRYPTION_SECRET_PASSWORD} )
544- encrypt_decrypt_domain_secret " decrypt" ${DOMAIN_HOME} ${MII_PASSPHRASE}
545- fi
529+ if [ -f " ${LOCAL_PRIM_DOMAIN_ZIP} " ] ; then
530+ trace " Using newly created domain"
531+ elif [ -f ${PRIMORDIAL_DOMAIN_ZIPPED} ] ; then
532+ trace " Using existing primordial domain"
533+ cd / && base64 -d ${PRIMORDIAL_DOMAIN_ZIPPED} > ${LOCAL_PRIM_DOMAIN_ZIP} && tar -xzf ${LOCAL_PRIM_DOMAIN_ZIP}
534+ # create empty lib since we don't archive it in primordial zip and WDT will fail without it
535+ mkdir ${DOMAIN_HOME} /lib
536+ # Since the SerializedSystem ini is encrypted, restore it first
537+ local MII_PASSPHRASE=$( cat ${RUNTIME_ENCRYPTION_SECRET_PASSWORD} )
538+ encrypt_decrypt_domain_secret " decrypt" ${DOMAIN_HOME} ${MII_PASSPHRASE}
539+ fi
546540
547- wdtUpdateModelDomain
541+ wdtUpdateModelDomain
548542
549- # This will be a no op if MII_USE_ONLINE_UPDATE is not defined or false
550- wdtHandleOnlineUpdate
543+ # This will be a no op if MII_USE_ONLINE_UPDATE is not defined or false
544+ wdtHandleOnlineUpdate
545+
546+ fi
551547
552548 trace " Exiting createModelDomain"
553549}
@@ -597,7 +593,6 @@ function diff_model_v1() {
597593 exitOrLoop
598594 fi
599595 trace " Exiting diff_model v1"
600- return ${rc}
601596}
602597
603598# This is WDT compareModel.sh implementation
@@ -628,29 +623,34 @@ function diff_model() {
628623 cat /tmp/compare_model_stdout
629624 exitOrLoop
630625 else
631- # Model is Identical, but env vars unrelated to the model may have changed (such as JAVA_OPTIONS)
632- MII_USE_ONLINE_UPDATE=false
626+ if [ ${SECRETS_AND_ENV_CHANGED} -eq 0 ] ; then
627+ # Merged model and env vars are identical, tell introspectDomain.sh not to run python and short circuit
628+ trace " Merged models and environment variables are identical, this introspection should be no-op."
629+ MERGED_MODEL_ENVVARS_SAME=" true"
630+ fi
633631 fi
634632 fi
635633 fi
636634
637- #
638- local ORACLE_SERVER_DIR=${ORACLE_HOME} /wlserver
639- local JAVA_PROPS=" -Dpython.cachedir.skip=true ${JAVA_PROPS} "
640- local JAVA_PROPS=" -Dpython.path=${ORACLE_SERVER_DIR} /common/wlst/modules/jython-modules.jar/Lib ${JAVA_PROPS} "
641- local JAVA_PROPS=" -Dpython.console= ${JAVA_PROPS} -Djava.security.egd=file:/dev/./urandom"
642- local CP=${ORACLE_SERVER_DIR} /server/lib/weblogic.jar
643- ${JAVA_HOME} /bin/java -cp ${CP} \
644- ${JAVA_PROPS} \
645- org.python.util.jython \
646- ${SCRIPTPATH} /model-diff.py $2 > ${WDT_OUTPUT} 2>&1
647- if [ $? -ne 0 ] ; then
648- trace SEVERE " Failed to compare models. Error output:"
649- cat ${WDT_OUTPUT}
650- exitOrLoop
635+ if [ " ${MERGED_MODEL_ENVVARS_SAME} " == " false" ] ; then
636+ # Generate diffed model update compatibility result
637+ local ORACLE_SERVER_DIR=${ORACLE_HOME} /wlserver
638+ local JAVA_PROPS=" -Dpython.cachedir.skip=true ${JAVA_PROPS} "
639+ local JAVA_PROPS=" -Dpython.path=${ORACLE_SERVER_DIR} /common/wlst/modules/jython-modules.jar/Lib ${JAVA_PROPS} "
640+ local JAVA_PROPS=" -Dpython.console= ${JAVA_PROPS} -Djava.security.egd=file:/dev/./urandom"
641+ local CP=${ORACLE_SERVER_DIR} /server/lib/weblogic.jar
642+ ${JAVA_HOME} /bin/java -cp ${CP} \
643+ ${JAVA_PROPS} \
644+ org.python.util.jython \
645+ ${SCRIPTPATH} /model-diff.py $2 > ${WDT_OUTPUT} 2>&1
646+ if [ $? -ne 0 ] ; then
647+ trace SEVERE " Failed to compare models. Error output:"
648+ cat ${WDT_OUTPUT}
649+ exitOrLoop
650+ fi
651651 fi
652+
652653 trace " Exiting diff_model"
653- return ${rc}
654654}
655655
656656#
@@ -661,7 +661,6 @@ function createPrimordialDomain() {
661661 trace " Entering createPrimordialDomain"
662662 local create_primordial_tgz=0
663663 local recreate_domain=0
664-
665664 if [ -f ${PRIMORDIAL_DOMAIN_ZIPPED} ] ; then
666665 # If there is an existing domain in the cm - this is update in the lifecycle
667666 # Call WDT validateModel.sh to generate the new merged mdoel
@@ -691,47 +690,51 @@ function createPrimordialDomain() {
691690 diff_model_v1 ${NEW_MERGED_MODEL} ${DECRYPTED_MERGED_MODEL}
692691 fi
693692
694- diff_rc=$( cat /tmp/model_diff_rc)
695- rm ${DECRYPTED_MERGED_MODEL}
696- trace " createPrimordialDomain: model diff return code list (can be empty): " ${diff_rc}
697-
698- local security_info_updated=" false"
699- local cannot_perform_online_update=" false"
700- security_info_updated=$( contain_returncode ${diff_rc} ${SECURITY_INFO_UPDATED} )
701- cannot_perform_online_update=$( contain_returncode ${diff_rc} ${NOT_FOR_ONLINE_UPDATE} )
702-
703- if [ ${cannot_perform_online_update} == " true" ] ; then
704- trace SEVERE \
705- " The Domain resource specified 'spec.configuration.model.onlineUpdate.enabled=true'," \
706- " but there are unsupported model changes for online update. Examples of unsupported" \
707- " changes include: changing ListenPort, ListenAddress, SSL, changing top level Topology attributes," \
708- " or deleting a ServerTemplate."
709- exitOrLoop
710- fi
693+ if [ " ${MERGED_MODEL_ENVVARS_SAME} " == " false" ] ; then
711694
712- # recreate the domain if there is an unsafe security update such as admin password update or security roles
695+ diff_rc=$( cat /tmp/model_diff_rc)
696+ rm ${DECRYPTED_MERGED_MODEL}
697+ trace " createPrimordialDomain: model diff return code list (can be empty): " ${diff_rc}
713698
714- # Always use the schema password in RCUDbInfo. Since once the password is updated by the DBA. The
715- # RCU cache table SCHEMA_COMPONENT_INFO stored password will never be correct, and subsequenetly any
716- # other updates such as admin credenitals or security roles that caused the re-create of the primordial
717- # domain will fail since without this flag set, defaults is to use the RCU cached info. (aka. wlst
718- # getDatabaseDefaults).
719- #
720- if [ ${security_info_updated} == " true" ] ; then
721- recreate_domain=1
722- if [ ${WDT_DOMAIN_TYPE} == " JRF" ] ; then
723- UPDATE_RCUPWD_FLAG=" -updateRCUSchemaPassword"
699+ local security_info_updated=" false"
700+ local cannot_perform_online_update=" false"
701+ security_info_updated=$( contain_returncode ${diff_rc} ${SECURITY_INFO_UPDATED} )
702+ cannot_perform_online_update=$( contain_returncode ${diff_rc} ${NOT_FOR_ONLINE_UPDATE} )
703+
704+ if [ ${cannot_perform_online_update} == " true" ] ; then
705+ trace SEVERE \
706+ " The Domain resource specified 'spec.configuration.model.onlineUpdate.enabled=true'," \
707+ " but there are unsupported model changes for online update. Examples of unsupported" \
708+ " changes include: changing ListenPort, ListenAddress, SSL, changing top level Topology attributes," \
709+ " or deleting a ServerTemplate."
710+ exitOrLoop
724711 fi
725- fi
726712
727- # if the domain is JRF and the schema password has been changed. Set this so that updateDomain will also update
728- # the RCU password using the RCUDnbinfo
713+ # recreate the domain if there is an unsafe security update such as admin password update or security roles
714+
715+ # Always use the schema password in RCUDbInfo. Since once the password is updated by the DBA. The
716+ # RCU cache table SCHEMA_COMPONENT_INFO stored password will never be correct, and subsequenetly any
717+ # other updates such as admin credenitals or security roles that caused the re-create of the primordial
718+ # domain will fail since without this flag set, defaults is to use the RCU cached info. (aka. wlst
719+ # getDatabaseDefaults).
720+ #
721+ if [ ${security_info_updated} == " true" ] ; then
722+ recreate_domain=1
723+ if [ ${WDT_DOMAIN_TYPE} == " JRF" ] ; then
724+ UPDATE_RCUPWD_FLAG=" -updateRCUSchemaPassword"
725+ fi
726+ fi
727+
728+ # if the domain is JRF and the schema password has been changed. Set this so that updateDomain will also update
729+ # the RCU password using the RCUDnbinfo
729730
730- local rcu_password_updated=" false"
731- rcu_password_updated=$( contain_returncode ${diff_rc} ${RCU_PASSWORD_CHANGED} )
732- if [ ${WDT_DOMAIN_TYPE} == " JRF" ] && [ ${rcu_password_updated} == " true" ] ; then
733- UPDATE_RCUPWD_FLAG=" -updateRCUSchemaPassword"
731+ local rcu_password_updated=" false"
732+ rcu_password_updated=$( contain_returncode ${diff_rc} ${RCU_PASSWORD_CHANGED} )
733+ if [ ${WDT_DOMAIN_TYPE} == " JRF" ] && [ ${rcu_password_updated} == " true" ] ; then
734+ UPDATE_RCUPWD_FLAG=" -updateRCUSchemaPassword"
735+ fi
734736 fi
737+
735738 fi
736739
737740 # If there is no primordial domain or needs to recreate one due to security changes
@@ -983,11 +986,12 @@ function wdtHandleOnlineUpdate() {
983986 # wdt shell script may return non-zero code if trap is on, then it will go to trap instead
984987 # temporarily disable it
985988 stop_trap
986- if [ -z ${MII_USE_ONLINE_UPDATE} ] || [ " false" == " ${MII_USE_ONLINE_UPDATE} " ] ; then
987- # no op for offline use case'
988- trace " Domain resource specified 'domain.spec.configuration.model.onlineUpdate=false' or not defined - no op"
989- trace " Exiting wdtHandleOnlineUpdate"
990- return
989+ if [ -z ${MII_USE_ONLINE_UPDATE} ] || [ " false" == " ${MII_USE_ONLINE_UPDATE} " ] || [ ! -f /tmp/diffed_model.yaml ] ; then
990+ # no op for offline use case or no change in model with new image
991+ trace " Domain resource specified 'domain.spec.configuration.model.onlineUpdate=false' or not defined or no " \
992+ " merged model is the same, no need for online update."
993+ trace " Exiting wdtHandleOnlineUpdate"
994+ return
991995 fi
992996
993997 # We need to extract all the archives, WDT online checks for file existence
0 commit comments