@@ -147,11 +147,12 @@ def get_servers(self):
147147 _logger .info ('WLSDPLY-06603' , len (servers ), class_name = _class_name , method_name = _method_name )
148148 name_token = self ._aliases .get_name_token (location )
149149 for server in servers :
150- _logger .info ('WLSDPLY-06604' , server , class_name = _class_name , method_name = _method_name )
151150 location .add_name_token (name_token , server )
152- result [server ] = OrderedDict ()
153- self ._populate_model_parameters (result [server ], location )
154- self ._discover_subfolders (result [server ], location )
151+ if not self ._dynamic_server (server , location ):
152+ _logger .info ('WLSDPLY-06604' , server , class_name = _class_name , method_name = _method_name )
153+ result [server ] = OrderedDict ()
154+ self ._populate_model_parameters (result [server ], location )
155+ self ._discover_subfolders (result [server ], location )
155156 location .remove_name_token (name_token )
156157 _logger .exiting (class_name = _class_name , method_name = _method_name , result = result )
157158 return model_top_folder_name , result
@@ -197,12 +198,13 @@ def get_migratable_targets(self):
197198 _logger .info ('WLSDPLY-06607' , len (targets ), class_name = _class_name , method_name = _method_name )
198199 name_token = self ._aliases .get_name_token (location )
199200 for target in targets :
200- _logger .info ('WLSDPLY-06608' , target , class_name = _class_name , method_name = _method_name )
201- location .add_name_token (name_token , target )
202- result [target ] = OrderedDict ()
203- self ._populate_model_parameters (result [target ], location )
204- self ._discover_subfolders (result [target ], location )
205- location .remove_name_token (name_token )
201+ if not self ._dynamic_target (target , location ):
202+ _logger .info ('WLSDPLY-06608' , target , class_name = _class_name , method_name = _method_name )
203+ location .add_name_token (name_token , target )
204+ result [target ] = OrderedDict ()
205+ self ._populate_model_parameters (result [target ], location )
206+ self ._discover_subfolders (result [target ], location )
207+ location .remove_name_token (name_token )
206208
207209 _logger .exiting (class_name = _class_name , method_name = _method_name )
208210 return model_top_folder_name , result
@@ -653,6 +655,75 @@ def _get_server_name_from_location(self, location):
653655 temp .append_location (model_constants .SERVER )
654656 return location .get_name_for_token (self ._aliases .get_name_token (temp ))
655657
658+ def _dynamic_target (self , target , location ):
659+ """
660+ Determine if the Migratable Target is connected to a dynamic server. This is determined in online mode
661+ only when the dynamic server and dynamic migratable target are created.
662+ :param target: migratable target to test for connection to dynamic server
663+ :param location: current location context
664+ :return: True if a dynamic server Migratable Target
665+ """
666+ if target .endswith ('(migratable)' ):
667+ server_name = target .split ('(migratable)' )[0 ].strip ()
668+ server_location = LocationContext ()
669+ server_location .append_location (model_constants .SERVER )
670+ server_location .add_name_token (self ._aliases .get_name_token (server_location ), server_name )
671+ wlst_path = self ._aliases .get_wlst_attributes_path (server_location )
672+ if self ._wlst_helper .path_exists (wlst_path ):
673+ return self ._dynamic_server (server_name , server_location )
674+ return False
675+
676+ def _dynamic_server (self , server , location ):
677+ """
678+ If this is online discover, determine if the server is part of a dynamic cluster.
679+ :param server: name of the server
680+ :param location: current location of the server
681+ :return: True if dynamic server
682+ """
683+ _method_name = '_dynamic_server'
684+ if self ._wlst_mode == WlstModes .ONLINE and self ._weblogic_helper .is_dynamic_clusters_supported ():
685+ wlst_path = self ._aliases .get_wlst_attributes_path (location )
686+ self ._wlst_helper .cd (wlst_path )
687+ cluster_attr = self ._aliases .get_wlst_attribute_name (location , model_constants .CLUSTER )
688+ cluster = self ._wlst_helper .get (cluster_attr )
689+ if cluster is not None :
690+ __ , cluster_name = self ._aliases .get_model_attribute_name_and_value (location , cluster_attr , cluster )
691+ cluster_location = LocationContext ()
692+ cluster_location .append_location (model_constants .CLUSTER )
693+ cluster_location .add_name_token (self ._aliases .get_name_token (cluster_location ), cluster_name )
694+ cluster_location .append_location (model_constants .DYNAMIC_SERVERS )
695+ cluster_location .add_name_token (self ._aliases .get_name_token (cluster_location ), cluster_name )
696+ wlst_path = self ._aliases .get_wlst_attributes_path (cluster_location )
697+ if self ._wlst_helper .path_exists (wlst_path ):
698+ _logger .fine ('WLSDPLY-06613' , server , class_name = _class_name , method_name = _method_name )
699+ self ._wlst_helper .cd (wlst_path )
700+ attr_name = self ._aliases .get_wlst_attribute_name (cluster_location ,
701+ model_constants .DYNAMIC_CLUSTER_SIZE )
702+ dynamic_size = self ._wlst_helper .get (attr_name )
703+ attr_name = self ._aliases .get_wlst_attribute_name (cluster_location ,
704+ model_constants .SERVER_NAME_PREFIX )
705+ prefix = self ._wlst_helper .get (attr_name )
706+ starting = 1
707+ present , __ = self ._aliases .is_valid_model_attribute_name (location ,
708+ model_constants .SERVER_NAME_PREFIX )
709+ if present :
710+ attr_name = self ._aliases .get_model_attribute_name (cluster_location ,
711+ model_constants .SERVER_NAME_START_IDX )
712+ starting = self ._wlst_helper .get (attr_name )
713+ return check_against_server_list (server , dynamic_size , prefix , starting )
714+ _logger .finer ('WLSDPLY-06614' , server , class_name = _class_name , method_name = _method_name )
715+ return False
716+
717+
718+ def check_against_server_list (server_name , dynamic_size , prefix , starting ):
719+ if dynamic_size > 0 and prefix is not None and server_name .startswith (prefix ):
720+ split_it = server_name .split (prefix )
721+ if len (split_it ) == 2 :
722+ number = StringUtils .stringToInteger (split_it [1 ].strip ())
723+ if number is not None and starting <= number < (dynamic_size + starting ):
724+ return True
725+ return False
726+
656727
657728def _kss_file_type (file_name ):
658729 if file_name .startswith (KSS_KEYSTORE_FILE_INDICATOR ):
0 commit comments