8
8
import re
9
9
10
10
from wlsdeploy .aliases import alias_utils
11
- from wlsdeploy .aliases .location_context import LocationContext
12
11
from wlsdeploy .aliases .model_constants import CLUSTER
13
12
from wlsdeploy .aliases .model_constants import DYNAMIC_CLUSTER_SIZE
14
13
from wlsdeploy .aliases .model_constants import DYNAMIC_SERVERS
15
14
from wlsdeploy .aliases .model_constants import MAX_DYNAMIC_SERVER_COUNT
16
15
from wlsdeploy .aliases .model_constants import SERVER
17
16
from wlsdeploy .aliases .model_constants import TOPOLOGY
18
- from wlsdeploy .aliases .validation_codes import ValidationCodes
19
17
from wlsdeploy .util import dictionary_utils
20
18
21
19
@@ -41,30 +39,24 @@ def get_dns_name(name):
41
39
return result
42
40
43
41
44
- def get_server_count (cluster_name , cluster_values , model_dictionary , aliases ):
42
+ def get_server_count (cluster_name , cluster_values , model_dictionary ):
45
43
"""
46
44
Determine the number of servers associated with a cluster.
47
45
:param cluster_name: the name of the cluster
48
46
:param cluster_values: the value map for the cluster
49
47
:param model_dictionary: the model dictionary
50
- :param aliases: aliases instance for validation
51
48
:return: the number of servers
52
49
"""
53
50
if DYNAMIC_SERVERS in cluster_values :
54
51
# for dynamic clusters, return the value of DynamicClusterSize
55
52
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 )
68
60
else :
69
61
# for other clusters, return the number of servers assigned to this cluster
70
62
count = 0
0 commit comments