|
1 | 1 | """
|
2 |
| -Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. |
| 2 | +Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | The Universal Permissive License (UPL), Version 1.0
|
4 | 4 | """
|
5 | 5 |
|
@@ -38,6 +38,49 @@ def __init__(self, model, model_context, aliases, exception_type, logger):
|
38 | 38 | else:
|
39 | 39 | self._admin_server_name = DEFAULT_ADMIN_SERVER_NAME
|
40 | 40 |
|
| 41 | + def target_jrf_groups_to_clusters_servers(self, domain_home, should_update=True): |
| 42 | + """ |
| 43 | + Use the apply_jrf only for those versions of wlst that do not have server groups. |
| 44 | + This assigns the JRF resources to all managed servers. If the managed server is in a |
| 45 | + cluster, this method assigns the JRF resources are assigned to the cluster. Else, if |
| 46 | + the managed server is stand-alone, the resources are assigned to the managed server. |
| 47 | + :param domain_home: the directory for the domain_home |
| 48 | + """ |
| 49 | + _method_name = 'target_jrf_groups_to_clusters_servers' |
| 50 | + |
| 51 | + self.logger.entering(domain_home, class_name=self.__class_name, method_name=_method_name) |
| 52 | + |
| 53 | + location = LocationContext() |
| 54 | + root_path = self.alias_helper.get_wlst_attributes_path(location) |
| 55 | + self.wlst_helper.cd(root_path) |
| 56 | + admin_server_name = self.wlst_helper.get(ADMIN_SERVER_NAME) |
| 57 | + |
| 58 | + # We need to get the effective list of servers for the domain. Since any servers |
| 59 | + # referenced in the model have already been created but the templates may have |
| 60 | + # defined new servers not listed in the model, get the list from WLST. |
| 61 | + server_names = self.get_existing_server_names() |
| 62 | + if admin_server_name in server_names: |
| 63 | + server_names.remove(admin_server_name) |
| 64 | + |
| 65 | + # Get the clusters and and their members |
| 66 | + cluster_map = self._get_clusters_and_members_map() |
| 67 | + |
| 68 | + # Get the clusters and and their members |
| 69 | + for cluster_name, cluster_servers in cluster_map.iteritems(): |
| 70 | + self.logger.info('WLSDPLY-12233', 'Cluster', cluster_name, class_name=self.__class_name, |
| 71 | + method_name=_method_name) |
| 72 | + self.wlst_helper.apply_jrf(cluster_name, domain_home, should_update=should_update) |
| 73 | + for member in cluster_servers: |
| 74 | + if member in server_names: |
| 75 | + server_names.remove(member) |
| 76 | + for ms_name in server_names: |
| 77 | + self.logger.info('WLSDPLY-12233', 'Managed Server', ms_name, class_name=self.__class_name, |
| 78 | + method_name=_method_name) |
| 79 | + self.wlst_helper.apply_jrf(ms_name, domain_home, should_update=should_update) |
| 80 | + |
| 81 | + self.logger.exiting(class_name=self.__class_name, method_name=_method_name) |
| 82 | + return |
| 83 | + |
41 | 84 | def target_server_groups_to_servers(self, server_groups_to_target):
|
42 | 85 | """
|
43 | 86 | Target the server groups to the servers.
|
@@ -148,6 +191,21 @@ def _get_clusters_and_members_map(self):
|
148 | 191 | self.logger.exiting(class_name=self.__class_name, method_name=_method_name, result=cluster_map)
|
149 | 192 | return cluster_map
|
150 | 193 |
|
| 194 | + def get_existing_server_names(self): |
| 195 | + """ |
| 196 | + Get the list of server names from WLST. |
| 197 | + :return: the list of server names |
| 198 | + :raises: BundleAwareException of the specified type: is an error occurs reading from the aliases or WLST |
| 199 | + """ |
| 200 | + _method_name = '_get_existing_server_names' |
| 201 | + |
| 202 | + self.logger.entering(class_name=self.__class_name, method_name=_method_name) |
| 203 | + server_location = LocationContext().append_location(SERVER) |
| 204 | + server_list_path = self.alias_helper.get_wlst_list_path(server_location) |
| 205 | + result = self.wlst_helper.get_existing_object_list(server_list_path) |
| 206 | + self.logger.exiting(class_name=self.__class_name, method_name=_method_name, result=result) |
| 207 | + return result |
| 208 | + |
151 | 209 | def _get_server_group_targeting_limits(self, server_group_targeting_limits, clusters_map):
|
152 | 210 | """
|
153 | 211 | Get any server group targeting limits specified in the model, converting any cluster
|
|
0 commit comments