88import  re 
99
1010from  wlsdeploy .aliases  import  alias_utils 
11- from  wlsdeploy .aliases .location_context  import  LocationContext 
1211from  wlsdeploy .aliases .model_constants  import  CLUSTER 
1312from  wlsdeploy .aliases .model_constants  import  DYNAMIC_CLUSTER_SIZE 
1413from  wlsdeploy .aliases .model_constants  import  DYNAMIC_SERVERS 
1514from  wlsdeploy .aliases .model_constants  import  MAX_DYNAMIC_SERVER_COUNT 
1615from  wlsdeploy .aliases .model_constants  import  SERVER 
1716from  wlsdeploy .aliases .model_constants  import  TOPOLOGY 
18- from  wlsdeploy .aliases .validation_codes  import  ValidationCodes 
1917from  wlsdeploy .util  import  dictionary_utils 
2018
2119
@@ -41,30 +39,24 @@ def get_dns_name(name):
4139 return  result 
4240
4341
44- def  get_server_count (cluster_name , cluster_values , model_dictionary ,  aliases ):
42+ def  get_server_count (cluster_name , cluster_values , model_dictionary ):
4543 """ 
4644 Determine the number of servers associated with a cluster. 
4745 :param cluster_name: the name of the cluster 
4846 :param cluster_values: the value map for the cluster 
4947 :param model_dictionary: the model dictionary 
50-  :param aliases: aliases instance for validation 
5148 :return: the number of servers 
5249 """ 
5350 if  DYNAMIC_SERVERS  in  cluster_values :
5451 # for dynamic clusters, return the value of DynamicClusterSize 
5552 dynamic_servers_dict  =  cluster_values [DYNAMIC_SERVERS ]
56-  location  =  LocationContext ()
57-  location .append_location (CLUSTER )
58-  location .add_name_token (aliases .get_name_token (location ), 'cluster' )
59-  location .append_location (DYNAMIC_SERVERS )
60-  location .add_name_token (aliases .get_name_token (location ), 'server' )
61-  present , __  =  aliases .is_valid_model_attribute_name (location , DYNAMIC_CLUSTER_SIZE )
62-  if  present  ==  ValidationCodes .VALID :
63-  cluster_size_value  =  dictionary_utils .get_element (dynamic_servers_dict , DYNAMIC_CLUSTER_SIZE )
64-  else :
65-  cluster_size_value  =  dictionary_utils .get_element (dynamic_servers_dict , MAX_DYNAMIC_SERVER_COUNT )
66-  if  cluster_size_value  is  not None :
67-  return  alias_utils .convert_to_type ('integer' , cluster_size_value )
53+ 
54+  # model may contain DYNAMIC_CLUSTER_SIZE or MAX_DYNAMIC_SERVER_COUNT 
55+  cluster_size  =  dictionary_utils .get_element (dynamic_servers_dict , DYNAMIC_CLUSTER_SIZE )
56+  if  cluster_size  is  None :
57+  cluster_size  =  dictionary_utils .get_element (dynamic_servers_dict , MAX_DYNAMIC_SERVER_COUNT )
58+  if  cluster_size  is  not None :
59+  return  alias_utils .convert_to_type ('integer' , cluster_size )
6860 else :
6961 # for other clusters, return the number of servers assigned to this cluster 
7062 count  =  0 
0 commit comments