14
14
from wlsdeploy .aliases .model_constants import SERVER_TEMPLATE
15
15
from wlsdeploy .aliases .model_constants import UNIX_MACHINE
16
16
from wlsdeploy .aliases .wlst_modes import WlstModes
17
+ from wlsdeploy .exception import exception_helper
17
18
from wlsdeploy .exception .expection_types import ExceptionType
18
19
from wlsdeploy .tool .create .security_provider_creator import SecurityProviderCreator
19
20
from wlsdeploy .tool .deploy import deployer_utils
@@ -34,16 +35,17 @@ def __init__(self, model, model_context, aliases, wlst_mode=WlstModes.OFFLINE):
34
35
Deployer .__init__ (self , model , model_context , aliases , wlst_mode )
35
36
self ._topology = self .model .get_model_topology ()
36
37
self ._resources = self .model .get_model_resources ()
37
- self ._topology_helper = TopologyHelper (self .aliases , ExceptionType .DEPLOY , self .logger )
38
+ self ._exception_type = ExceptionType .DEPLOY
39
+ self ._topology_helper = TopologyHelper (self .aliases , self ._exception_type , self .logger )
38
40
self ._domain_typedef = self .model_context .get_domain_typedef ()
39
41
40
42
self ._security_provider_creator = SecurityProviderCreator (model .get_model (), model_context , aliases ,
41
- ExceptionType . DEPLOY , self .logger )
43
+ self . _exception_type , self .logger )
42
44
43
45
self .library_helper = LibraryHelper (self .model , self .model_context , self .aliases ,
44
- model_context .get_domain_home (), ExceptionType . DEPLOY , self .logger )
46
+ model_context .get_domain_home (), self . _exception_type , self .logger )
45
47
46
- self .target_helper = TargetHelper (self .model , self .model_context , self .aliases , ExceptionType . DEPLOY ,
48
+ self .target_helper = TargetHelper (self .model , self .model_context , self .aliases , self . _exception_type ,
47
49
self .logger )
48
50
49
51
# Override
@@ -72,7 +74,11 @@ def update(self):
72
74
"""
73
75
Deploy resource model elements at the domain level, including multi-tenant elements.
74
76
"""
77
+ # For issue in setServerGroups in online mode (new configured clusters and stand-alone managed servers
78
+ # will not have extension template resources targeted)
79
+ existing_managed_servers , existing_configured_clusters = self ._create_list_of_setservergroups_targets ()
75
80
domain_token = deployer_utils .get_domain_token (self .alias_helper )
81
+
76
82
location = LocationContext ()
77
83
location .add_name_token (domain_token , self .model_context .get_domain_name ())
78
84
@@ -104,24 +110,33 @@ def update(self):
104
110
# create placeholders for Servers that are in a cluster as /Server/JTAMigratableTarget
105
111
# can reference "other" servers
106
112
self ._topology_helper .create_placeholder_servers_in_cluster (self ._topology )
113
+
107
114
self ._process_section (self ._topology , folder_list , SERVER , location )
108
115
109
116
self ._process_section (self ._topology , folder_list , MIGRATABLE_TARGET , location )
110
117
118
+ new_managed_server_list , new_configured_cluster_list = self ._create_list_of_setservergroups_targets ()
119
+
120
+ self ._check_for_online_setservergroups_issue (existing_managed_servers , new_managed_server_list )
121
+ self ._check_for_online_setservergroups_issue (existing_configured_clusters , new_configured_cluster_list )
122
+
111
123
# process remaining top-level folders. copy list to avoid concurrent update in loop
112
124
remaining = list (folder_list )
113
125
for folder_name in remaining :
114
126
self ._process_section (self ._topology , folder_list , folder_name , location )
115
127
116
128
if self .wls_helper .is_set_server_groups_supported ():
117
129
server_groups_to_target = self ._domain_typedef .get_server_groups_to_target ()
118
- self .target_helper .target_server_groups_to_servers (server_groups_to_target )
119
- elif self ._domain_typedef .domain_type_has_jrf_resources ():
120
- deployer_utils .save_changes (self .model_context )
121
- self .target_helper .target_jrf_groups_to_clusters_servers (self .model_context .get_domain_home ())
122
- deployer_utils .read_again (self .model_context )
123
-
124
- # files referenced in attributes are extracted as attributes are processed
130
+ server_assigns , dynamic_assigns = \
131
+ self .target_helper .target_server_groups_to_servers (server_groups_to_target )
132
+ if dynamic_assigns is not None :
133
+ self .wlst_helper .save_and_close (self .model_context )
134
+ self .target_helper .target_server_groups_to_dynamic_clusters (dynamic_assigns )
135
+ self .wlst_helper .reopen (self .model_context )
136
+ if server_assigns is not None :
137
+ self .target_helper .target_server_groups (server_assigns )
138
+ elif self ._domain_typedef .is_jrf_domain_type ():
139
+ self .target_helper .target_jrf_groups_to_clusters_servers ()
125
140
126
141
self .library_helper .install_domain_libraries ()
127
142
self .library_helper .extract_classpath_libraries ()
@@ -153,3 +168,67 @@ def _set_domain_attributes(self):
153
168
attribute_path = self .alias_helper .get_wlst_attributes_path (location )
154
169
self .wlst_helper .cd (attribute_path )
155
170
self .set_attributes (location , attrib_dict )
171
+
172
+ def is_online_with_ext_templates (self ):
173
+ return self .model_context .is_wlst_online () and self .model_context .get_domain_typedef ().has_extension_templates ()
174
+
175
+ def _check_for_online_setservergroups_issue (self , existing_list , new_list ):
176
+ _method_name = '_check_for_online_setservergroups_issue'
177
+ if len (existing_list ) != len (new_list ):
178
+ for entity_name in new_list :
179
+ if entity_name not in existing_list :
180
+ self .logger .warning ('WLSDPLY-09701' , entity_name ,
181
+ class_name = self ._class_name , method_name = _method_name )
182
+ return
183
+
184
+ def _create_list_of_setservergroups_targets (self ):
185
+ """
186
+ If an update is executed in online WLST mode, return a list of all existing configured / mixed clusters and
187
+ stand-alone managed servers. This method will be invoked to create a list of existing, and a list of new
188
+ as added by the update tool. These lists will be compared to determine if they will encounter
189
+ the online WLST problem with setServerGroups. The setServerGroups will target template resources to the
190
+ new entities, but this targeting is not persisted to the config.xml.
191
+ """
192
+ _method_name = '_create_list_of_setservergroups_targets'
193
+ self .logger .entering (class_name = self ._class_name , method_name = _method_name )
194
+
195
+ if not self .is_online_with_ext_templates ():
196
+ self .logger .exiting (class_name = self ._class_name , method_name = _method_name )
197
+ return list (), list ()
198
+
199
+ location = LocationContext ().append_location (SERVER )
200
+ server_path = self .alias_helper .get_wlst_list_path (location )
201
+ existing_managed_servers = list ()
202
+ existing_servers = self .wlst_helper .get_existing_object_list (server_path )
203
+ if existing_servers is not None :
204
+ name_token = self .alias_helper .get_name_token (location )
205
+ for server_name in existing_servers :
206
+ location .add_name_token (name_token , server_name )
207
+ wlst_path = self .alias_helper .get_wlst_attributes_path (location )
208
+ self .wlst_helper .cd (wlst_path )
209
+ cluster_attribute = self .alias_helper .get_wlst_attribute_name (location , CLUSTER )
210
+ cluster_value = self .wlst_helper .get (cluster_attribute )
211
+ if cluster_value is None :
212
+ existing_managed_servers .append (server_name )
213
+ location .remove_name_token (name_token )
214
+
215
+ existing_configured_clusters = list ()
216
+ location = LocationContext ().append_location (CLUSTER )
217
+ cluster_path = self .alias_helper .get_wlst_list_path (location )
218
+ existing_clusters = self .wlst_helper .get_existing_object_list (cluster_path )
219
+ if existing_clusters is not None :
220
+ name_token = self .alias_helper .get_name_token (location )
221
+ for cluster_name in existing_clusters :
222
+ location .add_name_token (name_token , cluster_name )
223
+ wlst_path = self .alias_helper .get_wlst_attributes_path (location )
224
+ self .wlst_helper .cd (wlst_path )
225
+ ds_mbean = self .alias_helper .get_wlst_mbean_type (location )
226
+ if not self .wlst_helper .subfolder_exists (ds_mbean ,
227
+ self .alias_helper .get_wlst_subfolders_path (location )):
228
+ existing_configured_clusters .append (cluster_name )
229
+ location .remove_name_token (name_token )
230
+
231
+ self .logger .exiting (class_name = self ._class_name , method_name = _method_name ,
232
+ result = 'configured_clusters=' + str (existing_configured_clusters ) +
233
+ ' managed servers=' + str (existing_managed_servers ))
234
+ return existing_configured_clusters , existing_managed_servers
0 commit comments