diff --git a/core/src/main/python/update.py b/core/src/main/python/update.py index 508bdd552..349b4e441 100644 --- a/core/src/main/python/update.py +++ b/core/src/main/python/update.py @@ -240,6 +240,8 @@ def __update_online(model, model_context, aliases): exit_code = 0 __update_online_domain(model_context) + __wlst_helper.edit() + __wlst_helper.start_edit() topology_updater.set_server_groups() __update_online_domain(model_context) diff --git a/core/src/main/python/wlsdeploy/tool/create/domain_creator.py b/core/src/main/python/wlsdeploy/tool/create/domain_creator.py index f064b54cf..816720b22 100644 --- a/core/src/main/python/wlsdeploy/tool/create/domain_creator.py +++ b/core/src/main/python/wlsdeploy/tool/create/domain_creator.py @@ -342,11 +342,11 @@ def __create_domain(self): if self.wls_helper.is_select_template_supported(): self.__create_base_domain_with_select_template(self._domain_home) + self.__extend_domain_with_select_template(self._domain_home) else: self.__create_base_domain(self._domain_home) + self.__extend_domain(self._domain_home) - topology_folder_list = self.alias_helper.get_model_topology_top_level_folder_names() - self.__apply_base_domain_config(topology_folder_list) if len(self.files_to_extract_from_archive) > 0: for file_to_extract in self.files_to_extract_from_archive: self.archive_helper.extract_file(file_to_extract) @@ -359,28 +359,6 @@ def __create_domain(self): self.logger.exiting(class_name=self.__class_name, method_name=_method_name) return - def __extend_domain_svrgrps(self): - """ - Create the domain. - :raises: CreateException: if an error occurs - """ - _method_name = '__create_domain' - - self.logger.entering(class_name=self.__class_name, method_name=_method_name) - domain_type = self.model_context.get_domain_type() - self.logger.info('WLSDPLY-12203', domain_type, class_name=self.__class_name, method_name=_method_name) - - self.wlst_helper.read_domain(self._domain_home) - - if self.wls_helper.is_select_template_supported(): - self.__extend_domain_with_select_template(self._domain_home) - else: - self.__extend_domain(self._domain_home) - - self.wlst_helper.update_domain() - self.logger.exiting(class_name=self.__class_name, method_name=_method_name) - return - def __deploy(self): """ Update the domain with domain attributes, resources and deployments. @@ -397,9 +375,10 @@ def __deploy(self): return def __deploy_after_update(self): - - self.__extend_domain_svrgrps() + _method_name = '__deploy_after_update' + self.logger.entering(class_name=self.__class_name, method_name=_method_name) model_deployer.deploy_model_after_update(self.model, self.model_context, self.aliases) + self.logger.exiting(class_name=self.__class_name, method_name=_method_name) def __deploy_resources_and_apps(self): """ @@ -449,8 +428,8 @@ def __extend_domain(self, domain_home): extension_templates = self._domain_typedef.get_extension_templates() custom_templates = self._domain_typedef.get_custom_extension_templates() - if (len(extension_templates) == 0) and (len(custom_templates) == 0): - return + # if (len(extension_templates) == 0) and (len(custom_templates) == 0): + # return self.logger.info('WLSDPLY-12207', self._domain_name, domain_home, class_name=self.__class_name, method_name=_method_name) @@ -466,6 +445,8 @@ def __extend_domain(self, domain_home): class_name=self.__class_name, method_name=_method_name) self.wlst_helper.add_template(custom_template) + topology_folder_list = self.alias_helper.get_model_topology_top_level_folder_names() + self.__apply_base_domain_config(topology_folder_list) self.__configure_fmw_infra_database() if self.wls_helper.is_set_server_groups_supported(): @@ -498,16 +479,6 @@ def __create_base_domain_with_select_template(self, domain_home): class_name=self.__class_name, method_name=_method_name) self.wlst_helper.select_template(base_template) - self.wlst_helper.load_templates() - - self.__set_core_domain_params() - self.logger.info('WLSDPLY-12205', self._domain_name, domain_home, - class_name=self.__class_name, method_name=_method_name) - self.wlst_helper.write_domain(domain_home) - self.wlst_helper.close_template() - self.logger.info('WLSDPLY-12206', self._domain_name, domain_home, - class_name=self.__class_name, method_name=_method_name) - self.wlst_helper.read_domain(domain_home) self.logger.exiting(class_name=self.__class_name, method_name=_method_name) return @@ -524,8 +495,6 @@ def __extend_domain_with_select_template(self, domain_home): extension_templates = self._domain_typedef.get_extension_templates() custom_templates = self._domain_typedef.get_custom_extension_templates() - if (len(extension_templates) == 0) and (len(custom_templates) == 0): - return for extension_template in extension_templates: self.logger.info('WLSDPLY-12211', extension_template, @@ -538,29 +507,62 @@ def __extend_domain_with_select_template(self, domain_home): self.wlst_helper.select_custom_template(custom_template) self.logger.info('WLSDPLY-12212', class_name=self.__class_name, method_name=_method_name) - if len(extension_templates) > 0 or len(custom_templates) > 0: - self.wlst_helper.load_templates() + self.wlst_helper.load_templates() + self.__set_core_domain_params() if len(extension_templates) > 0: self.__set_app_dir() self.__configure_fmw_infra_database() + self.__configure_opss_secrets() + topology_folder_list = self.alias_helper.get_model_topology_top_level_folder_names() + self.__apply_base_domain_config(topology_folder_list) self.logger.info('WLSDPLY-12206', self._domain_name, domain_home, class_name=self.__class_name, method_name=_method_name) - server_groups_to_target = self._domain_typedef.get_server_groups_to_target() server_assigns, dynamic_assigns = self.target_helper.target_server_groups_to_servers(server_groups_to_target) if len(server_assigns) > 0: self.target_helper.target_server_groups(server_assigns) - self.__configure_opss_secrets() - if len(dynamic_assigns) > 0: self.target_helper.target_server_groups_to_dynamic_clusters(dynamic_assigns) + self.logger.info('WLSDPLY-12205', self._domain_name, domain_home, + class_name=self.__class_name, method_name=_method_name) + self.wlst_helper.write_domain(domain_home) + self.wlst_helper.close_template() + self.logger.info('WLSDPLY-12206', self._domain_name, domain_home, + class_name=self.__class_name, method_name=_method_name) + self.wlst_helper.read_domain(domain_home) self.logger.exiting(class_name=self.__class_name, method_name=_method_name) return + def __set_server_groups(self): + _method_name = '__set_server_groups' + self.logger.entering(class_name=self.__class_name, method_name=_method_name) + if self.wls_helper.is_set_server_groups_supported(): + # 12c versions set server groups directly + server_groups_to_target = self._domain_typedef.get_server_groups_to_target() + server_assigns, dynamic_assigns = self.target_helper.target_server_groups_to_servers(server_groups_to_target) + if len(server_assigns) > 0: + self.target_helper.target_server_groups(server_assigns) + + if len(dynamic_assigns) > 0: + self.target_helper.target_server_groups_to_dynamic_clusters(dynamic_assigns) + + elif self._domain_typedef.is_jrf_domain_type() or \ + (self._domain_typedef.get_targeting() == TargetingType.APPLY_JRF): + # for 11g, if template list includes JRF, or if specified in domain typedef, use applyJRF + self.target_helper.target_jrf_groups_to_clusters_servers() + self.logger.exiting(class_name=self.__class_name, method_name=_method_name) + + def __update_domain(self): + _method_name = '__update_domain' + self.logger.entering(class_name=self.__class_name, method_name=_method_name) + self.wlst_helper.update_domain() + self.wlst_helper.close_domain() + self.logger.exiting(class_name=self.__class_name, method_name=_method_name) + def __apply_base_domain_config(self, topology_folder_list): """ Apply the base domain configuration from the model topology section. @@ -758,7 +760,7 @@ def __create_clusters_and_servers(self, location): # create placeholders for JDBC resources that may be referenced in cluster definition. resources_dict = self.model.get_model_resources() - self.topology_helper.create_placeholder_jdbc_resources(resources_dict) + jdbc_names = self.topology_helper.create_placeholder_jdbc_resources(resources_dict) cluster_nodes = dictionary_utils.get_dictionary_element(self._topology, CLUSTER) if len(cluster_nodes) > 0: self._create_named_mbeans(CLUSTER, cluster_nodes, location, log_created=True) @@ -779,6 +781,9 @@ def __create_clusters_and_servers(self, location): if len(server_nodes) > 0: self._create_named_mbeans(SERVER, server_nodes, location, log_created=True) + # targets may have been inadvertently assigned when clusters were added + self.topology_helper.clear_jdbc_placeholder_targeting(jdbc_names) + self.logger.exiting(class_name=self.__class_name, method_name=_method_name) return diff --git a/core/src/main/python/wlsdeploy/tool/deploy/topology_updater.py b/core/src/main/python/wlsdeploy/tool/deploy/topology_updater.py index 1fa639455..c7bb1c80e 100644 --- a/core/src/main/python/wlsdeploy/tool/deploy/topology_updater.py +++ b/core/src/main/python/wlsdeploy/tool/deploy/topology_updater.py @@ -102,7 +102,7 @@ def update(self): self._topology_helper.create_placeholder_server_templates(self._topology) # create placeholders for JDBC resources that may be referenced in cluster definition. - self._topology_helper.create_placeholder_jdbc_resources(self._resources) + jdbc_names = self._topology_helper.create_placeholder_jdbc_resources(self._resources) self._process_section(self._topology, folder_list, CLUSTER, location) self._process_section(self._topology, folder_list, SERVER_TEMPLATE, location) @@ -113,6 +113,9 @@ def update(self): self._process_section(self._topology, folder_list, SERVER, location) + # targets may have been inadvertently assigned when clusters were added + self.topology_helper.clear_jdbc_placeholder_targeting(jdbc_names) + self._process_section(self._topology, folder_list, MIGRATABLE_TARGET, location) new_managed_server_list, new_configured_cluster_list = self._create_list_of_setservergroups_targets() diff --git a/core/src/main/python/wlsdeploy/tool/util/target_helper.py b/core/src/main/python/wlsdeploy/tool/util/target_helper.py index fc4f60f31..6659730ac 100644 --- a/core/src/main/python/wlsdeploy/tool/util/target_helper.py +++ b/core/src/main/python/wlsdeploy/tool/util/target_helper.py @@ -207,7 +207,7 @@ def target_server_groups_to_dynamic_clusters(self, dynamic_cluster_assigns): If JRF or RestrictedJRF skip the check and do the applyJRF function to automatically target to the cluster. :param dynamic_cluster_assigns: The assignments from domainInfo targeting limits applied to dynamic lusters """ - _method_name = 'target_server_group_resources_to_dyanamic_cluster' + _method_name = 'target_server_groups_to_dynamic_clusters' self.logger.entering(str(dynamic_cluster_assigns), class_name=self.__class_name, method_name=_method_name) domain_typedef = self.model_context.get_domain_typedef() diff --git a/core/src/main/python/wlsdeploy/tool/util/topology_helper.py b/core/src/main/python/wlsdeploy/tool/util/topology_helper.py index 3b9fd0e3e..c8d29f030 100644 --- a/core/src/main/python/wlsdeploy/tool/util/topology_helper.py +++ b/core/src/main/python/wlsdeploy/tool/util/topology_helper.py @@ -93,8 +93,9 @@ def create_placeholder_jdbc_resources(self, resources): Create a placeholder JDBC resource for each name in the resources section. This is necessary because cluster attributes may reference JDBC resources. :param resources: the resource model nodes + :return: a list of names of created placeholders """ - self.create_placeholder_named_elements(LocationContext(), JDBC_SYSTEM_RESOURCE, resources) + return self.create_placeholder_named_elements(LocationContext(), JDBC_SYSTEM_RESOURCE, resources) def create_placeholder_named_elements(self, location, model_type, model_nodes): """ @@ -103,8 +104,10 @@ def create_placeholder_named_elements(self, location, model_type, model_nodes): :param location: the location for the nodes to be added :param model_type: the type of the specified model nodes :param model_nodes: the model nodes + :return: a list of names of created placeholders """ _method_name = 'create_placeholder_named_elements' + holder_names = [] original_location = self.wlst_helper.get_pwd() resource_location = LocationContext(location).append_location(model_type) @@ -125,8 +128,10 @@ def create_placeholder_named_elements(self, location, model_type, model_nodes): resource_location.add_name_token(token, name) deployer_utils.create_and_cd(resource_location, existing_names, self.alias_helper) self._update_placeholder(model_type, name, resource_location) + holder_names.append(name) self.wlst_helper.cd(original_location) + return holder_names def _update_placeholder(self, type_name, name, location): """ @@ -148,6 +153,26 @@ def _update_placeholder(self, type_name, name, location): self.wlst_helper.set('Name', name) self.wlst_helper.cd(original_location) + def clear_jdbc_placeholder_targeting(self, jdbc_names): + """ + Remove any targets for the JDBC resources in the specified list of names. + Targets may have been inadvertently assigned when clusters were added after JDBC placeholders. + :param jdbc_names: names of placeholders to clear + """ + _method_name = 'clear_jdbc_placeholder_targeting' + resource_location = LocationContext().append_location(JDBC_SYSTEM_RESOURCE) + token = self.alias_helper.get_name_token(resource_location) + + for name in jdbc_names: + self.logger.info('WLSDPLY-19404', JDBC_SYSTEM_RESOURCE, name, class_name=self.__class_name, + method_name=_method_name) + + resource_location.add_name_token(token, name) + wlst_path = self.alias_helper.get_wlst_attributes_path(resource_location) + if self.wlst_helper.path_exists(wlst_path): + mbean = self.wlst_helper.get_mbean_for_wlst_path(wlst_path) + mbean.setTargets(None) + def qualify_nm_properties(self, type_name, model_nodes, base_location, model_context, attribute_setter): """ For the NM properties MBean, update the keystore file path to be fully qualified with the domain directory. diff --git a/core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/Server.json b/core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/Server.json index 8c9fbb8aa..c1f5bc95f 100644 --- a/core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/Server.json +++ b/core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/Server.json @@ -250,7 +250,7 @@ "LogFileSeverity": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "LogFileSeverity", "wlst_path": "WP001", "value": {"default": "Trace" }, "wlst_type": "string" } ], "LogMonitoringEnabled": [ {"version": "[12.2.1,)", "wlst_mode": "both", "wlst_name": "LogMonitoringEnabled", "wlst_path": "WP001", "value": {"default": "true" }, "wlst_type": "boolean"} ], "LogMonitoringIntervalSecs": [ {"version": "[12.2.1,)", "wlst_mode": "both", "wlst_name": "LogMonitoringIntervalSecs", "wlst_path": "WP001", "value": {"default": 30 }, "wlst_type": "integer"} ], - "LogMonitoringMaxThrottleMessageSignatureCount": [ {"version": "[12.2.1.1,)", "wlst_mode": "online", "wlst_name": "LogMonitoringMaxThrottleMessageSignatureCount", "wlst_path": "WP001", "value": {"default": 1000 }, "wlst_type": "integer"} , + "LogMonitoringMaxThrottleMessageSignatureCount": [ {"version": "[12.2.1.1,12.2.1.3)", "wlst_mode": "online", "wlst_name": "LogMonitoringMaxThrottleMessageSignatureCount", "wlst_path": "WP001", "value": {"default": 1000 }, "wlst_type": "integer"} , {"version": "[12.2.1.3,)", "wlst_mode": "both", "wlst_name": "LogMonitoringMaxThrottleMessageSignatureCount", "wlst_path": "WP001", "value": {"default": 1000 }, "wlst_type": "integer"} ], "LogMonitoringThrottleMessageLength": [ {"version": "[12.2.1,)", "wlst_mode": "both", "wlst_name": "LogMonitoringThrottleMessageLength", "wlst_path": "WP001", "value": {"default": 50 }, "wlst_type": "integer"} ], "LogMonitoringThrottleThreshold": [ {"version": "[12.2.1,)", "wlst_mode": "both", "wlst_name": "LogMonitoringThrottleThreshold", "wlst_path": "WP001", "value": {"default": 1500 }, "wlst_type": "integer"} ], diff --git a/core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties b/core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties index c5def216b..3335edd7b 100644 --- a/core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties +++ b/core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties @@ -1345,6 +1345,7 @@ WLSDPLY-19400=Creating placeholder for server template {0} WLSDPLY-19401=Creating placeholder for JDBC resource {0} WLSDPLY-19402=Creating placeholder for Server resource {0} WLSDPLY-19403=Creating placeholder for {0} {1} +WLSDPLY-19404=Clearing targets for {0} placeholder {1} # wlsdeploy/tool/util/variable_injector.py WLSDPLY-19500=Model variable injector values loaded from location {0}