Skip to content

Jira wdt 343 subbranch #573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Mar 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions core/src/main/python/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
97 changes: 51 additions & 46 deletions core/src/main/python/wlsdeploy/tool/create/domain_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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.
Expand All @@ -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):
"""
Expand Down Expand Up @@ -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)
Expand All @@ -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():
Expand Down Expand Up @@ -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
Expand All @@ -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,
Expand All @@ -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.
Expand Down Expand Up @@ -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)
Expand All @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/python/wlsdeploy/tool/util/target_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
27 changes: 26 additions & 1 deletion core/src/main/python/wlsdeploy/tool/util/topology_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand All @@ -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)

Expand All @@ -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):
"""
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"} ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down